question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error 'Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version 1.1.0.0'

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:32 (6 by maintainers)

github_iconTop GitHub Comments

39reactions
GuerrillaCodercommented, Aug 23, 2017

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.

13reactions
luis-fsscommented, Oct 11, 2019

Downgrading “Microsoft.VisualStudio.Web.CodeGeneration.Design” from 3.0.0 to 2.2.4 resolved the issue for me. VS2019, AspNet Core 2.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core Scaffolding does not work in VS 2017
Error: Scaffolding failed. Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration, Version=3.0.0.0, Culture=neutral, ...
Read more >
Microsoft.VisualStudio.Web.CodeGeneration.Utils not ...
IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=3.1.1.0, Culture=neutral, ...
Read more >
Microsoft.VisualStudio.Web.CodeGeneration.Utils 7.0.9
Version Downloads Last updated 8.0.0‑preview.7.23408.2 641 5 days ago 8.0.0‑preview.6.23360.4 3,059 a month ago 8.0.0‑preview.5.23313.2 3,612 2 months ago
Read more >
Visual Studio: Could not load file or asembly "System.Web. ...
When I try to connect to my TFS repo via Team Explorer - Connect I receive this error (see pic): Could not load...
Read more >
ASP.NET Core - RSSing.com
IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=1.1.0.0, Culture=neutral, PublicKeyToken ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found