1

I'm using VS2017 on a brand new ASP.net core web application (version 1.1) and when I try to add 'api controller with actions using entity framework' I get the following error message:

There was an error running the selected code generator: 'Version for package 'Microsoft.VisualStudio.Web.CodeGeneration.Tools' could not be resolved.'

I've googled a bit and found a few suggestions, one of which was to add a CLI tool reference in the .csproj file, so I have added the following:

<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" 
         Version="1.0.1" />
</ItemGroup>

This version matched the installed version according to the NuGet package manager. However the problem still persists. Any suggestions on how to fix this please?

1 Answer 1

1

After a few hours of headbanging, I stumbled across this post: System could not be found Visual Studio 2017 ASP.NET Core project

I followed the advice to enable automatic check for missing packages and it finally worked!

I had the same problem, first when converting a VS2015 net core mvc web project to 2017 and then when trying to create a new core web application in 2017.

Went to Tools|NuGet Package Manager|Package Manager Settings - checked 'Allow NuGet to download missing packages' and 'Automatically check for missing packages during build in VS' and then clicked 'Clear All NuGet Cache(s)'. Then re-built the solution - it found and loaded all the required packages and ran OK.

May not work for all cases but simple and worth a try.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.