Wednesday, 22 February 2017

Resolve MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found or Unable to start the process. No executable found matching command "dotnet-projectmodel-server"

You might encounter compilation error in Visual Studio 2015 when a new .NET Core 1 web app is created, if you have installed Visual Studio 2017 (RC as of now). When a new .NET Core 1 web application is created/opened in Visual Studio 2015, with the project template you get with .NET Core 1.0.1 tools Preview 2, while having ".NET Core cross-platform development" for Visual Studio 2017 in your machine, you might see below error prompted.
---------------------------
Microsoft Visual Studio
---------------------------
The following error occurred attempting to run the project model server process (1.0.0-rc4-004771).

Unable to start the process. No executable found matching command "dotnet-projectmodel-server"
The project model server process provides intellisense, build, and reference information to Visual Studio and without it your experience will be very limited. Please try closing and reopening Visual Studio to see if that corrects the problem. Alternatively, check that the .NET Core SDK is properly installed.
---------------------------
OK  
---------------------------

When attempt to compile the solution you may encounter a compilation error below.
WebApp.xproj(7,3): error MSB4019: The imported project "C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Open/Create .NET Core 1 Web App errorimage
Compilation errorimage
You might see references for the Core 1 web app is not restored.image
Reason for this issue is when you setup ".NET Core cross-platform development" for Visual Studio 2017 .NET Core SDK 1.0.0-rc4-004771 or higher is installed and VS 2015 does not support this SDK. Multiple SDKs here confuse VS 2015.image
How to resolve?
Add a global.json file to the location of the solution file.image
Set the SDK version (version should be 1.0.0- preview version available in your macine) as shown below in global.json.
{
  "sdk": {
    "version": "1.0.0-preview2-003131"
  }
}
image
Now close and open the solution in visual studio 2015 and you can see the restore of references. No errors when opening solution.image
Build solution works and you should be able to run the application.image
image

10 comments:

Anonymous said...

thanks a bunch. Its very helpful to me.

Plz share your mail id.

Sam said...

Hi Chaminda, Your posts are very informative. This question is off this topic. But here it is
I am new to TFS and when i build my app and Package binaries by passing inline MSBuild Argument:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation=$(build.artifactstagingdirectory)
Also used "Publish Build Artifact" task and provided path to publish as "$(build.artifactstagingdirectory)"
Binaries are copied as zip but with this lengthy folder path on build server; \$BuildServer\e$\WebWork\1\a\Content\E_C\WebWork\1\s\Dev\ProviderGeoSearch\obj\Release\Package\PackageTmp$Allbinarieshere.
Want to reduce these lengthy subfolders.

Ashen Upendra Disanayaka said...

Very helpful. Thank you very much

Chaminda Chandrasekara said...

@Sam Instead of publish artifacts use copy publish artifacts task and then provide patterns for content such as **/*.zip which will reduce the path length. If you have multiple locations in your output having defined content lowest possible path with the content will be created in drop depending on the content search pattern you set.

David Verrière said...

Thanks a lot for your post.
I have encoutered issue after updating the .Net core sdk.
I have not install vs 2017 for the moment

Microsoft is forcing dev to migrate to VS 2017, I think it's too early

Anonymous said...

this post is resolved my problem & thanx for the great post

Anonymous said...

Thanks bro u saved my life :) :) :)

isabellaJoseph said...

It’s too informative blog and I am getting conglomerations of info’s about Dotnet certification. Thanks for sharing; I would like to see your updates regularly so keep blogging.
Regards
Dot Net Training in Chennai
Selenium Training in Chennai
Android Training in Chennai

john stany said...


Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing..
Android App Development Company

pratik kapadia said...

Thanks ..It is working ..