Closed danroot closed 4 years ago
@danroot can your upgrade the versions from 1.0.0-msbuild3-final
to 1.0.0
and 1.1.0-msbuild3-final
to 1.1.0
in your project?
About the error
Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1 .
You should not see this if <PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
this is in the project.
@prafullbhosale If I update those packages, I get the error Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1
. The line you mention is already in the project (see listed csproj). I have tried the other mentioned fix, excluding Microsoft.Composition and adding System.Composition, but this does not resolve the issue. Only removing Microsoft.VisualStudio.Web.CodeGeneration.Design fixes that, but then scaffolding errors out saying it needs that reference.
@danroot can you provide the project.assets.json
file located under obj folder after you upgrade the versions and restore the project?
OK, I misspoke on that last comment. I still get the same error 'Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version 1.1.0.0' if I just remove the -msbuild3-final. It is only if I add <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Utils" Version="1.1.0" />
to the last ItemGroup that I then move to the Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1.
error. (Adding as a PackageReference instead of DotNetCliToolReference to either ItemGroup results in the original 'could not find assembly Microsoft.VisualStudio.Web.CodeGeneration.Utils' error)
Here is a project.assets.json (renamed .txt to get past GitHub) without .Utils added.
project.assets.json.txt
Here is a project.assets.json with .utils added. project.assets.with.utils.json.txt
<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" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
It is only if I add
to the last ItemGroup that I then move to the Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1.
That makes sense.
<DotNetCliToolReference>
is only for CLI tools that are to be included with the project. The PackageTargetFallback
doesn't work for these.
You shouldn't need to add the Microsoft.VisualStudio.Web.CodeGeneration.Utils
package at all to your project.
Can you provide me the version for visual studio 2017 community edition you are using? Help -> About Visual Studio
Also can you paste the output of running dotnet --info
on command line?
Should be patched up, though I am a little fuzzy on the tools. 1.0.3 tools are used for both 1.0 and 1.1 core right? This machine is the Azure VM Server 2016 image with VS Community pre-installed, then both windows and vs updates run.
Visual Studio About
Microsoft Visual Studio Community 2017
Version 15.1 (26403.7) Release
VisualStudio.15.Release/15.1.0+26403.7
Microsoft .NET Framework
Version 4.6.01586
Installed Version: Community
Visual Basic 2017 00369-60000-00001-AA598
Microsoft Visual Basic 2017
Visual C# 2017 00369-60000-00001-AA598
Microsoft Visual C# 2017
Visual C++ 2017 00369-60000-00001-AA598
Microsoft Visual C++ 2017
Visual F# 4.1 00369-60000-00001-AA598
Microsoft Visual F# 4.1
ASP.NET and Web Tools 2017 15.0.30320.0
ASP.NET and Web Tools 2017
ASP.NET Web Frameworks and Tools 2012 4.0.11203.0
For additional information, visit https://www.asp.net/
ASP.NET Web Frameworks and Tools 2017 5.2.50303.0
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 15.0.30209.0
Azure App Service Tools v3.0.0
Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.2.5000.0
Microsoft Azure Data Lake Tools for Visual Studio
Common Azure Tools 1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Dotfuscator Community Edition 5.27.0.4679-release+ce-vs15.e4937ba.20161216.158
PreEmptive Protection - Dotfuscator CE
Fabric.ApplicationInsights 1.0
Allows user to instrument their Service Fabric projects for Application Insights.
Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events
GitHub.VisualStudio 2.2.0.8
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
JavaScript UWP Project System 2.0
JavaScript UWP Project System
KofePackagePackage Extension 1.0
KofePackagePackage Visual Studio Extension Detailed Info
MenuCommands Extension 1.0
MenuCommands Visual Studio Extension Detailed Info
Merq 1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.
Microsoft Azure Hive Query Language Service 2.2.5000.0
Language service for Hive query
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50131.1
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
Mono Debugging for Visual Studio Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.
Node.js Tools 1.3.50316.00
Adds support for developing and debugging Node.js apps in Visual Studio
NuGet Package Manager 4.1.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Office Developer Tools for Visual Studio 2017 ENU 15.0.26112
Microsoft Office Developer Tools for Visual Studio 2017 ENU
Redgate SQL Search 2.4.1.1284
Search functionality for SQL Server databases, from within Visual Studio
SQL Server Data Tools 15.1.61702.140
Microsoft SQL Server Data Tools
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript 2.1.5.0
TypeScript tools for Visual Studio
Visual C++ for Cross Platform Mobile Development (Android) 15.0.26228.00
Visual C++ for Cross Platform Mobile Development (Android)
Visual C++ for Cross Platform Mobile Development (iOS) 15.0.26228.00
Visual C++ for Cross Platform Mobile Development (iOS)
Visual C++ for Linux Development 1.0.6
Visual C++ for Linux Development
Visual Studio Tools for Apache Cordova 15.113.6201.1
Visual Studio Tools for Apache Cordova
Visual Studio tools for CMake 1.0
Visual Studio tools for CMake
Visual Studio Tools for Unity 3.1.0.0
Visual Studio Tools for Unity
Visual Studio Tools for Universal Windows Apps 15.0.26403.07
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.
Xamarin 4.4.0.34 (3f99c5a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android SDK 7.2.0.7 (b16fb82)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 10.8.0.174 (7656cc6)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
dotnet --info
Product Information:
Version: 1.0.3
Commit SHA-1 hash: 37224c9917
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.3
I am having this issue with version 1.1.1.0.
I was able to get things working by ensuring that all nuget packages were up to date. Strangely, it seems that updating App Insights was what did the trick.
For what it is worth I was able to work around this problem by deleting my project files locally, then re-checked out the solution from source control. Still don't know the cause though.
I also have this issue. Any solutions?
If I create a new solution then scaffolding works. I have compared dependencies from my actual project to new project and they are the same. I have tried clearing all nuget caches and still same problem on this project, I cannot add any scaffolded items.
Do I just have to copy all code across to a new project when this happens? Anyone tracked down the cause?
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.
@GuerrillaCoder Thanks man, this works for me.
Switching from Release back to Debug did the trick for me too!
@GuerrillaCoder I deleted bin & obj and it works. You saved my night. Thank you.
For me, these suggestions didn't solve. i'm using vs2019 - "Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0"
Downgrading "Microsoft.VisualStudio.Web.CodeGeneration.Design" from 3.0.0 to 2.2.4 resolved the issue for me. VS2019, AspNet Core 2.2
@Lukkian Your solution worked for me as well!! Thanks
Thanks @Lukkian , that worked for me !!!
Downgrading "Microsoft.VisualStudio.Web.CodeGeneration.Design" from 3.0.0 to 2.2.4 resolved the issue for me. VS2019, AspNet Core 2.2
These are the corresponding CodeGeneration.Design packages to use for the following TFMs:
.NET CoreApp 2.1 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/2.1.10
.NET CoreApp 2.2 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/2.2.4
.NET CoreApp 3.0 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/3.0.0
Hope this helps. We are trying to improve the experience by failing to install the package that is not compatible.
The reason we need these mapping packages is because the content generated for each of these TFMs could be different.
Closing this issue. Let us know if you still run into issues with the above packages.
Hello Guys,
On running this command: dotnet aspnet-codegenerator controller -name ValuesController -async -api --readwriteActions -outDir Controllers
I'm getting this error:
Building project ... Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified. File name: 'Microsoft.VisualStudio.Web.CodeGeneration.Utils, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.Main(String[] args)
RunTime 00:00:07.02
Is this issue still? I just updated to the latest .net core@3.1.0
I was getting similar issues then i realized my mistake. I had update to EF Core 3.1 and updated all my Nuget packages to 3.1 which was a mistake. My project was still targeting .Net Core 3.0 so I needed to keep the 3.0 version of Microsoft.VisualStudio.Web.CodeGeneration.Design to match the .Net Core version my project targets.
Note: the Nuget package manager UI in visual studio suggests I update to 3.1 so you can get caught out if you blindly update all packages.
Estes são os pacotes CodeGeneration.Design correspondentes a serem usados nos seguintes TFMs:
.NET CoreApp 2.1 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/2.1.10
.NET CoreApp 2.2 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/2.2.4
.NET CoreApp 3.0 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/3.0.0
Espero que isto ajude. Estamos tentando melhorar a experiência ao não instalar o pacote que não é compatível.
A razão pela qual precisamos desses pacotes de mapeamento é porque o conteúdo gerado para cada um desses TFMs pode ser diferente.
Thank you!! Your solution resolved my problem =D
These are the corresponding CodeGeneration.Design packages to use for the following TFMs:
.NET CoreApp 2.1 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/2.1.10
.NET CoreApp 2.2 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/2.2.4
.NET CoreApp 3.0 -> https://www.nuget.org/packages/Microsoft.VisualStudio.Web.CodeGeneration.Design/3.0.0
Hope this helps. We are trying to improve the experience by failing to install the package that is not compatible.
The reason we need these mapping packages is because the content generated for each of these TFMs could be different.
@deepchoudhery - When scaffolding fails with this error in VS, can you add the above information to the error message? This will help users who have not checked this github thread.
Reinstall Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Utils
I'm using ASP.NET Core 3.1 with Razor Pages. Visual Studio 2019 installs Microsoft.VisualStudio.Web.CodeGeneration.Design 3.1.3. Deleting bin & obj, doesn't work. Install Microsoft.VisualStudio.Web.CodeGeneration.Utils, then it can't find Microsoft.VisualStudio.Web.CodeGeneration. Install it, then it can't find Microsoft.VisualStudio.Web.CodeGenerators.Mvc... (I can't remember exact order) Then I give up, delete all these new packages, including Microsoft.VisualStudio.Web.CodeGeneration.Design. Then add Razor Pages again, this time it works smoothly, with Microsoft.VisualStudio.Web.CodeGeneration.Design 3.1.3 installed only.
I found that originally the reference <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.0" ExcludeAssets="all" />
has ExcludeAssets="all"
. I added it manually because of How to stop the localized Microsoft.CodeAnalysis.*.resources.dll files from getting published by ASP.NET Core? problem. That should be my original problem. Remove this reference then add again solves.
Thank you @ChrisTorng ... I had the exact same issue because I put the ExcludeAssets="All"
tag in there for the same reason (it's one of those things you set and forget). The error that they throw for this scenario ("The system cannot find the file specified") could be much better, but removing that tag fixes the code generation issue and adds the view.
Worked for me
I am getting:-could not load file or assembly 'microsoft.visualstudio.web.codegeneration.utils version 3.0.0.0. In dot net core 2.2 in visual studio 2017 Please follow these steps to fix this problem its work for me
I know this thread is closed, but if it fails the first time, it still succeeded in installing the nuget packages. Build and retry and you will be good to go.
The thread closed but I had same issue in VS2019 and it has resolved by clean solution and retry to add New Scaffolded item
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:
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:
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.