作者:凌波_薇步 | 来源:互联网 | 2023-08-25 08:43
我跟随https://docs.microsoft.com/en-us/aspnet/core/tutorials/razor-pages/model?view=aspnetcore-3.1&tabs=visual-studio-code并跑步
dotnet tool install --global dotnet-aspnet-codegenerator
dotnet aspnet-codegenerator razorpage -m Movie -dc RazorPagesMovieContext -udl -outDir Pages\Movies --referenceScriptlibraries
那之后,我得到了错误
Building project ...
Scaffolding failed.
Add microsoft.VisualStudio.Web.CodeGeneration.Design package to the project as a NuGet package reference.
To see more information,enable tracing by setting environment variable 'codegen_trace' = 1.
RunTime 00:00:03.47
我尝试使用添加程序包
dotnet add package microsoft.VisualStudio.Web.CodeGeneration.Design --version 3.1.0
并获取错误
Writing C:\Users\tdong.BCFSA\AppData\Local\Temp\tmpA5E0.tmp
info : Adding PackageReference for package 'microsoft.VisualStudio.Web.CodeGeneration.Design' into
project 'D:\Work\Testing\Movies\RazorPagesMovie\RazorPagesMovie.csproj'.
info : Restoring packages for D:\Work\Testing\Movies\RazorPagesMovie\RazorPagesMovie.csproj...
error: Package NuGet.Frameworks 4.7.0 is not compatible with netcoreapp3.1
(.NETCoreApp,Version=v3.1). Package NuGet.Frameworks 4.7.0 does not support any target frameworks.
error: Package 'microsoft.VisualStudio.Web.CodeGeneration.Design' is incompatible with 'all'
frameworks in project 'D:\Work\Testing\Movies\RazorPagesMovie\RazorPagesMovie.csproj'.