Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Path is empty" error when scaffolding in a project that references Microsoft.AspNetCore.Identity #1713

Open
Extragorey opened this issue Nov 29, 2021 · 4 comments

Comments

@Extragorey
Copy link

Extragorey commented Nov 29, 2021

Issue

The following error is thrown when running the command dotnet aspnet-codegenerator identity -lf.
The same error (sans stack trace) also occurs when attempting to scaffold any view via the IDE context menu.

[Trace]: Command Line: identity -lf
    Building project ...
    [Trace]: Command Line: --no-dispatch --port-number 64193 identity -lf --dispatcher-version 6.0.0+cc9d1f5236d926269a0471042f72bf83b498509c
    Scaffolding failed.
    The path is empty. (Parameter 'path')
    [Trace]:    at System.IO.Path.GetFullPath(String path)
       at System.IO.Enumeration.FileSystemEnumerator`1..ctor(String directory, Boolean isNormalized, EnumerationOptions options)
       at System.IO.Enumeration.FileSystemEnumerable`1..ctor(String directory, FindTransform transform, EnumerationOptions options, Boolean isNormalized)
       at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
       at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
       at Microsoft.VisualStudio.Web.CodeGeneration.Msbuild.ProjectContextWriter.GetScaffoldingAssemblies(IEnumerable`1 dependencies)
       at Microsoft.DotNet.Scaffolding.Shared.ProjectModel.ProjectContextExtensions.AddPackageDependencies(IProjectContext projectInformation, String projectAssetsFile)
       at Microsoft.VisualStudio.Web.CodeGeneration.Design.Program.<>c__DisplayClass4_0.<<Execute>b__0>d.MoveNext()
    RunTime 00:00:02.43

Reproduction Steps

  1. Create a new project using the template "ASP.NET Core Web App (Model-View-Controller)" targeting .NET 6.0 and with the authentication type set to Individual Accounts.
  2. Add the following Nuget package:
    • Microsoft.VisualStudio.Web.CodeGeneration.Design (to support scaffolding)
  3. Save all files (Ctrl + Shift + S) and rebuild the solution.
  4. At this point, open cmd to the project file's directory and run dotnet aspnet-codegenerator identity -lf to ensure the list of available Identity views for scaffolding is shown successfully.
  5. Add the following Nuget package:
    • Microsoft.AspNetCore.Identity
  6. Save all files (Ctrl + Shift + S) and rebuild the solution.
  7. Try to re-run the command dotnet aspnet-codegenerator identity -lf and the above error should occur.

Environment Info

Target framework: .NET 6.0
IDE: Visual Studio 2022 17.0.1
Operating system: Windows Server 2016 Standard

Issue originally posted on StackOverflow (by me).

@Extragorey Extragorey changed the title "Path not found" error when scaffolding in a project that references Microsoft.AspNetCore.Identity "Path is empty" error when scaffolding in a project that references Microsoft.AspNetCore.Identity Nov 29, 2021
@anghelvalentin
Copy link

I have the same issue. Did you manage to solve it?

@Extragorey
Copy link
Author

Extragorey commented Jan 8, 2022 via email

@anghelvalentin
Copy link

I have written a tutorial about adding identity to an existing ASP.NET application and I have also presented the solution for this bug https://programmingcsharp.com/implement-identity-on-existing-asp-project/

@JRoxellin
Copy link

anghelvalentin muchas gracias me salvaste la vida ese error tan pequeño me llevo a perder la cabeza muchas graciassss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants