After creating a solution on one machine I then tried to open it on another and got the following error.

If you ignore this error and then try to build the project an error saying “MSB1009 Project file does not exist.” is recieved.

The project was originally created in Visual Studio 2015 and then opened in Visual Studio 2015 on a different machine, the problem seems to have occurred because Visual Studio 2017 was also installed on the 2nd machine and this installed an updated version of the SDK. Projects try to use the most recent SDK version if it’s not specified but as the project was initially built on a machine without this version this seems to cause some problems.

In order to fix this a global.json file needs to be created in which the intended SDK version is specified. This should be created in a folder called “Solution Items” as below.

In the global.json file the SDK version can then be specified.


{
  "projects": [],
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}

Installed SDK versions can be discovered by going to %PROGRAMFILES%\dotnet\sdk


Leave a Reply

Your email address will not be published. Required fields are marked *