question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Identity scaffolding failed in VS 2019 when updating the package to v3.0.0-preview5-19264-04

See original GitHub issue

While I add the new scaffold item for the fresh my ASP-NET Core 3 Web-Api project for the first time, it worked perfectly. But, I found the scaffold-generator making several folders on my project and all identity data was placed in the area folder. For some reason, I want to re-scaffold new one and try other costumes in the parameters. Before I try again using the scaffold-generator, I delete all the files and folders added by the previous scaffold-generator and update some packages by Nuget Package Manager, this time an error appears as below.

Error message on console

Finding the generator 'identity'...
Running the generator 'identity'...
There was an error running the template C:\Users\yuant\.nuget\packages\microsoft.visualstudio.web.codegenerators.mvc\3.0.0-preview5-19264-04\Templates\Identity\Pages\_Layout.cshtml: Template Processing Failed:(95,13): error CS0103: The name 'BeginWriteAttribute' does not exist in the current context
(96,13): error CS0103: The name 'EndWriteAttribute' does not exist in the current context
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.<BuildCommandLine>b__6_0()
   at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.ActionInvoker.Execute(String[] args)
   at Microsoft.VisualStudio.Web.CodeGeneration.CodeGenCommand.Execute(String[] args)

Error message on IDE

Error-scaffold

my.csproj

<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <LangVersion>8.0</LangVersion>
  </PropertyGroup>

<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-preview5-19227-01" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0-preview5-19227-01" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview5-19227-01" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview5.19227.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="3.0.0-preview5.19227.1" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview5.19227.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.0.0-preview5.19227.9" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.0.0-preview5-19264-04" />
  </ItemGroup>

</Project>

Is the error message like above caused by a package update or something else? Can I get clues to resolve this problem. TY

Microsoft Visual Studio 2019 16.0.4 Microsoft Windows 10

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
seancpeterscommented, Jun 22, 2019

The 3.0.0 release will have a fix for this issue, and is coming relatively soon We may release another preview prior to that, but uncertain at this point.

1reaction
lailaDevcommented, May 24, 2019

I have the same problem when i try to generate ‘new scaffold item’ for the first time for a ‘react’ project , with latest version of visual studio 2019 (16.2.0 Preview 1.0) and .net core SDK. in attachement my .csproj file Csproj.txt

Read more comments on GitHub >

github_iconTop Results From Across the Web

Identity scaffolding failed in VS 2019 when updating the ...
The problem is most likely caused by using the older version of the Microsoft.VisualStudio.Web.CodeGeneration.Design package, in conjunction ...
Read more >
Why does Scaffolding Identity for .NET Core 3.1 and .NET 5 ...
I found a workaround for this error by using the dotnet CLI outside of Visual Studio to execute the scaffolding tool.
Read more >
Identity scaffolding in .net core 6.0 gives error message " ...
Hello, I've been trying to scaffold various Identity pages, however I keep getting an error dialog which says "There was an error running...
Read more >
Untitled
Rolling back package changes VS2019 Fix Update: Scaffolding failed, could not load information for … Package restore failed. Rolling back package changes ...
Read more >
Scaffolding in VS 2019 failed in .NET Core 3.1
I have a workaround for now which should work for you. I will need you to do the following: Delete %ProgramData%\Microsoft\VisualStudio\Packages ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found