09 February 2017

.Net Core Project Files

I've spent he last few weeks playing around with the new project format (csproj) and VS2017 RC2 seeing if its possible to work with this format AND allow for Cross Platform development i.e. using VS2017 on Windows, [Visual Studio Code](https://code.visualstudio.com/) on a Mac and also [VS2015](https://www.visualstudio.com/) or command line (Windows, Mac, Linux). Here are my notes from this work.

Project File Format

As of writing (9/2/2017) there are three possible formats:
* csproj: The new project format of csproj files BUT cannot be built on Mac [see this issue](https://github.com/Microsoft/vsts-tasks/issues/3311). The tooling just isn't there yet.
* xproj: project.json replacement using in VS2015. We can have project.json and xproj in same project, although not ideal as obviously they need to be kept in sync.
* project.json: Less features than the other two (e.g. not full msbuild support) and will be deprecated in favour of csproj
NB: As of writing if you open a project.json or xproj in VStudio2017 it will transform the project files into csproj moving the old to a 'backup' folder. Not all the tooling supports csproj yet.

Building

* dotnet restore
* dotnet build (optional, build will also happen when it's run)

Testing

* VSCode: Run individual tests using the C# Extension OmniSharp
* Command line: dotnet test [path/project Name NOT project file]

Running

* VSCode: Use the Debug Panel
* Command line:
  * dotnet build */**/project.json
  * [Project path] > dotnet run [path/project Name NOT project file]

No comments:

Post a Comment