Skip to content

Blazor template with individual auth breaks on windows (Data\app.db?) #60807

Open
@skyslide22

Description

@skyslide22

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

My Blazor project with individual auth using a local sqllite database breaks on windows, this is the command i used to create the project on macos:
dotnet new blazor --auth Individual -int WebAssembly

So this creates a app.db file in the Data folder in the Server project, and when running dotnet ef database update it actually creates a new file in the Server project with the name Data\app.db, also the appsettings.json have this backslash instead of a forward slash:

  "ConnectionStrings": {
    "DefaultConnection": "DataSource=Data\\app.db;Cache=Shared"
  },

The app runs fine on macos, but it fails to find the file on azure/windows, changing the backslash to a forward slash fixed the issue.
Also checking out to a project with this template on windows after cloning the repo fails in visual studio, fixed with slash change in appsettings.json and deleting the Data\app.db file (the backward slash is part of the file name, Data is not a folder in this case)

i have used dotnet 8 and 9, same behaviour

Image

Image

Expected Behavior

Project created with dotnet new blazor --auth Individual -int WebAssembly on macos to be working on windows as well

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

8 & 9

Anything else?

No response

Activity

ghost added
area-blazorIncludes: Blazor, Razor Components
on Mar 7, 2025
added
area-identityIncludes: Identity and providers
and removed
area-blazorIncludes: Blazor, Razor Components
on Mar 9, 2025
MackinnonBuck

MackinnonBuck commented on Mar 12, 2025

@MackinnonBuck
Member

Thanks for reaching out, @skyslide22. Just to clarify, did the Data\app.db file get created by running dotnet ef database update on a Mac? This does seem like a bug if so.

MackinnonBuck

MackinnonBuck commented on Mar 12, 2025

@MackinnonBuck
Member

One fix would just be to move the app.db file from the Data folder to the root in the template. Alternatively, we could change the \\ to a /, since that should work on Windows.

added this to the 10.0-preview4 milestone on Mar 12, 2025
skyslide22

skyslide22 commented on Mar 12, 2025

@skyslide22
Author

Yes the Data\app.db file gets added when running dotnet ef database update or accessing http://localhost:5136/Account/Login and submit the form for example.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-identityIncludes: Identity and providers

    Type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @javiercn@MackinnonBuck@skyslide22

        Issue actions

          Blazor template with individual auth breaks on windows (Data\app.db?) · Issue #60807 · dotnet/aspnetcore