Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design Error 6.0 v 7.0

Dean Everhart 1,541 Reputation points
2023-02-01T18:59:18.8533333+00:00

Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design

renders following error message:

PM> install-package microsoft.VisualStudio.Web.CodeGeneration.Design
Restoring packages for C:\Users\User1\Desktop\Authentication\WebApplication1\WebApplication1\WebApplication1.csproj...
  GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json
  OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/index.json 89ms
  GET https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/7.0.3/microsoft.visualstudio.web.codegeneration.design.7.0.3.nupkg
  OK https://api.nuget.org/v3-flatcontainer/microsoft.visualstudio.web.codegeneration.design/7.0.3/microsoft.visualstudio.web.codegeneration.design.7.0.3.nupkg 57ms
Installed Microsoft.VisualStudio.Web.CodeGeneration.Design 7.0.3 from https://api.nuget.org/v3/index.json with content hash xiXuMTZFwZ0efmfUCbK4bABMip+bENVS6B7vgkGd7wNeOg8+p7b0b2vt8YZIMTyQvlH7Qo+HzNhZRHsLNvlILw==.
install-package : NU1202: Package Microsoft.VisualStudio.Web.CodeGeneration.Design 7.0.3 is not 
compatible with net6.0 (.NETCoreApp,Version=v6.0). Package 
Microsoft.VisualStudio.Web.CodeGeneration.Design 7.0.3 supports: net7.0 
(.NETCoreApp,Version=v7.0)
At line:1 char:1
+ install-package microsoft.VisualStudio.Web.CodeGeneration.Design
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCm 
   dlets.InstallPackageCommand
 
install-package : Package restore failed. Rolling back package changes for 'WebApplication1'.
At line:1 char:1
+ install-package microsoft.VisualStudio.Web.CodeGeneration.Design
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCm 
   dlets.InstallPackageCommand
 
Time Elapsed: 00:00:01.7330233
PM> 

Tutorial: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-6.0&tabs=visual-studio#scaffold-identity-into-a-razor-project-with-authorization

The tutorial is suppose to be for .net core 6.0 / the error message indicates there is a version discrepency...it wants to install for 7.0 (which I'm not running).

Any help appreciated.

Developer technologies ASP.NET ASP.NET Core
Developer technologies ASP.NET Other
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-02-01T20:34:44.98+00:00

    you need to specify the version:

    pm> NuGet\Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design -Version 6.0.11

    7 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-02-01T20:36:08.94+00:00

    (extra post to make my previous display)


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.