-
Notifications
You must be signed in to change notification settings - Fork 124
Microsoft.VisualStudio.Web.CodeGeneration.Tools has been deprecated in favor of dotnet-aspnet-codegenerator #1075
Comments
I'm not clear what effect this has (as it hasn't been explained in these announcements), but I have to say that this package was the devil. Right Click -> Add -> Controller from an MVC Project, which drags this package in, is the worst thing that I keep forgetting I shouldn't do. By doing so, I'm immediately adding around 20 useless DLLs to my Publish. With that I'm pretty confident that if this is what I think it is (something that won't drag in actual build dependencies / references to generate a ~15 line file), I'm massively excited about this change 🎉 |
Is this going to replace the automatic package addition in visual studio as described by @rudiv? |
@AngelosP so is this mean we can run the line below on CommandPrompt
and then remove the line below from project files? <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" /> |
Hi all, Error Package 'dotnet-aspnet-codegenerator 2.1.0' has a package type 'DotnetTool' that is not supported by project 'myproject'. Anyone have the same error? |
The dotnet aspnet-codegenerator global tool is only necessary to install when scaffolding from the command line. If you’re only scaffolding from Visual Studio, it is not necessary to install the global tool. When scaffolding from Visual Studio, it’s no longer necessary to include the package reference to Microsoft.VisualStudio.Web.CodeGeneration.Tools. But scaffolding will still add the references needed by the generated content, as well as a reference to Microsoft.VisualStudio.Web.CodeGeneration.Design If you want to scaffold from the command line, then the global tool should be installed from the command line, using the command: It should not be installed into any specific project via the nuget package manager in VS. |
Ah, so this doesn't actually fix the deployment issue wherein lots of further (unneeded) files are dragged in to the project? That must be |
dotnet-aspnet-codegenerator behaves differently from the previous tool, here is an example: In the previous tool the following would create a valid configuration: However using the new tool: then:
All of the UI related setup is added under /Areas/Identity inside IdentityHostingStartup.cs and uses SqlServer rather then Sqlite, but Startup.cs is left untouched so the code generated by
It seems that the new tool has been designed to add Identity to an existing non-identity enabled project, which seems to make sense, however the docs should cover this if not already. EDIT: This is covered in the ScaffoldingReadme.txt
The only existing file touched by the new tool was appsettings.json to add a new connection string, which is why --force needed to be used. |
Yeap! I have got this error when I tried to load my project on another computer, every dependencies was unresolved such as NuGet and SDK. I just opened my project.csproj on Notepad and removed the CodeGenerator.Design from ItemGroup Tag and then reloaded the project in visual studio. My problem was solved. |
Microsoft.VisualStudio.Web.CodeGeneration.Tools has been deprecated in favor of https://www.nuget.org/packages/dotnet-aspnet-codegenerator/
The text was updated successfully, but these errors were encountered: