dotnet / Scaffolding

Code generators to speed up development.
MIT License
635 stars 227 forks source link

Scaffolding error the same as issue 25898 with latest version of VS2019 #1517

Open lukies97 opened 3 years ago

lukies97 commented 3 years ago

Describe the bug

When i use the Visual Studio 2019 Professional UI to add a scaffolding item, it reverts my Nuget packages to older versions and then fails. I'm attempting to add an Identity scaffolded item with .Net Core 5.0.2. When I right click on the project, and selected to add a new scaffolded item, then it tries to update dependencies. It then reverts my codegeneration.design to version 5.0.0-rc.1.20453.2. It also reverts EntityFrameworkCore.SqlServer and .Tools to the same version. I then get the same popup from issue 25898

To Reproduce

Create a project. Use as.net core web application template with authentication. target .netcore 5. try to add scaffolded item.

If you looked at the nuget packages before and after, you'll notice it downgrades some of them.

Exceptions (if any)

image

before: image after: image

Further technical details

Runtime Environment: OS Name: Windows OS Version: 10.0.18363 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.102\

Host (useful for support): Version: 5.0.2 Commit: cb5f173b96

.NET SDKs installed: 5.0.102 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

mkArtakMSFT commented 3 years ago

@vijayrkn, @deepchoudhery can you please take a look at this? Thanks!

lukies97 commented 3 years ago

I also receive this message on occasion.

image

lukies97 commented 3 years ago

I also attempted reverting to .net core 3.1 and it still didn't work with the same error. It however did reset which versions of the nuget packages I selected to the ones it thought it should use instead of using the ones selected in the package manager.

lukies97 commented 3 years ago

I actually got it to work by reverting all my nuget packages prior to the one that it automatically tries to change it to. I'm not confident which one did it, but I changed packages to these in order for the scaffolding to work. I think the code generation one is the one that did it.

microsoft.entityframeworkcore.sqlserver\5.0.0-rc.1.20451.13\ microsoft.entityframeworkcore.tools\5.0.0-rc.1.20451.13\ microsoft.aspnetcore.apiauthorization.identityserver\5.0.0-rc.1.20451.17\ microsoft.aspnetcore.diagnostics.entityframeworkcore\5.0.0-rc.1.20451.17\ microsoft.aspnetcore.identity.entityframeworkcore\5.0.0-rc.1.20451.17\ microsoft.aspnetcore.identity.ui\5.0.0-rc.1.20451.17\ microsoft.aspnetcore.spaservices.extensions\5.0.0-rc.1.20451.17\ microsoft.entityframeworkcore.design\5.0.0-rc.1.20451.13\ microsoft.entityframeworkcore.relational\5.0.0-rc.1.20451.13\ microsoft.visualstudio.web.codegeneration.design\5.0.0-rc.1.20453.2\

deepchoudhery commented 3 years ago

The config has been updated over the air and you should have release versions for all the packages. Another way to fix this would be to delete all the packages and retry scaffolding. It should install all the appropriate latest packages.

Let me know if that works.