Error 'Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version 1.1.0.0'
See original GitHub issueI am attempting to scaffold a controller in an ASP.NET Core app targeting 1.1 in Visual Studio 2017 Community. When I do, I get the error:
'Could not load file or assembly ‘Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version 1.1.0.0’
I’ve read up on similar issues, and gotten this to work in the command line on a Mac with Visual Studio Code by adding the “PackageTargetFallback” shown below. However, am unable to get this working on VS2017 on Windows 2012.
If I fiddle with the Microsoft.VisualStudio.Web.CodeGeneration.Design and Microsoft.VisualStudio.Web.CodeGeneration.Tool references to get newer versions, and to add Microsoft.VisualStudio.Web.CodeGeneration.Utils DotNetCliToolsReference I get different errors such as:
Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1 .
This is referenced in issue #18452, but the “fix” is to remove Microsoft.VisualStudio.Web.CodeGeneration.Design, which breaks scaffolding.
Is scaffolding supported in netcorapp1.1 & visual studio 2017? If so, what is wrong with my environment and/or csproj here?
.csproj is below.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Hangfire" Version="1.6.12" />
<PackageReference Include="Hangfire.Console" Version="1.3.1" />
<PackageReference Include="MailKit" Version="1.14.2" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0-msbuild3-final" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild3-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
</ItemGroup>
</Project>
Issue Analytics
- State:
- Created 6 years ago
- Comments:32 (6 by maintainers)
Top GitHub Comments
I found a solution. I deleted bin & obj folders then it gave me error it couldnt find project.deps.json in debug folder. I set project to debug, ran it and now I can add scaffolded items.
Downgrading “Microsoft.VisualStudio.Web.CodeGeneration.Design” from 3.0.0 to 2.2.4 resolved the issue for me. VS2019, AspNet Core 2.2