TWiG #2: Frustrations with .NET Core tooling and VS Code

Published: 05 February 2017

Things I learned

Rename Refactor in VS Code

In last week’s update I alluded to the fact that I miss many of the refactorings which is offered by Visual Studio and Resharper. One good find this week is that VS Code at least has Rename Symbol functionality. As explained by the VS Code Documentation:

Some languages support rename symbol across files. Simply press F2 and then type the new desired name and press Enter. All usages of the symbol will be renamed, across files.

Would appreciate proper refactorings, but for now this one at least proved very helpful during the past week as I made some design changes.


I added a unit test project to my application, and obviously needed to reference the main project from the unit test project, and updated my project.json for the unit test project accordingly:

  "version": "1.0.0-*",
  "buildOptions": {
    "debugType": "portable"
  "dependencies": {
    "GeoToast": {
      "target": "project"
    "System.Runtime.Serialization.Primitives": "4.3.0-preview1-24530-04",
    "xunit": "2.1.0",
    "dotnet-test-xunit": "1.0.0-rc2-192208-24"

I was wondering how on earth the dotnet restore process will know where to access the GeoToast project, since it is obviously in a completely different folder. For reference, this is my folder structure:

      |__Source Files
      |__Test Files

And right on cue, I got an error message stating Unable to resolve ‘GeoToast’ for ‘.NETCoreApp,Version=v1.1’:

Turns out I should have read docs on Creating a Unit Test more thoroughly, since they state very clearly that you need to add a global.json file to the root folder of your application that contains the names of the src and test folders:

    "projects": [

That sorted the problem out and dotnet restore worked like a charm.

For more information check out the global.json reference.

MSBuild: With the switch to MSBuild this will change, so if you check this blog post a few months from now, this may not be applicable anymore. .notice–warning

Customising validation responses

I wanted to customise the responses I sent from the API when validation fails. I wrote about how to do this in Handling validation responses for ASP.NET Core Web API.

Things I found frustrating

Hiccups after installing Visual Studio 2017 RC

I installed Visual Studio 2017 RC for some other work I was doing, which also installed the .NET Core Tools RC3 with support for the new MSBuild support.

Initially when I tried to do a dotnet restore on my GeoToast project (which was still project.json based) I got the following error:

MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

Sorting out this problem is easy. Just add the following to your global.json:

    "sdk": {
        "version": "1.0.0-preview2-003121"

That constrains dotnet to using the project.json-based tooling. Check out the “Side by side install” section in MSBuild tools announcement.

See this commit for the changes

Changing to MSBuild

After the change described above, I actually converted my projects over to the new csproj files. I used the approach described in the “Upgrading project.json projects” section of the MSBuild tools announcement.

It involved simply removing the sdk section I previously added to my global.json file and then running the dotnet migrate command as described in that document. I ran it from the root folder of my project and it picked up both my projects and converted them. Besides removing the project.json files, the migration process also removed the global.json file.

The whole process was seamless and both my main and test projects still worked fine after running dotnet restore for both of them. The dotnet watch command also seems to still be working.

See this commit for the changes.

Reaching my limit with VS Code?

I think I have reached my limit with VS Code. I set it as a clear goal with this project to learn VS Code, but I am feeling too unproductive. I can code much faster using Visual Studio + Resharper. While it is important to learn new things, I am also conscious of the fact that I do not have much free time to work on this project. The little bit of time I have I need to be able to use as productively as possible.

With that in mind I am seriously considering forsaking VS Code in favour of Visual Studio 2017 + Resharper. Will let you know next week what I decided ;)

Plans for the coming week

Speaking of next week… I need to go to Japan for a month for work purposes, so I am probably going to have even less time. This coming week especially I need to sort out a few final thing before I leave Bangkok, then travel to Tokyo, and after that settle in in Japan.

So I am not sure how much time I will have this coming week for working on GeoToast.

PS: If you found this content valuable and want to return the favour, then please feel free to ☕ buy me a coffee