Description
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
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
MackinnonBuck commentedon Mar 12, 2025
Thanks for reaching out, @skyslide22. Just to clarify, did the
Data\app.db
file get created by runningdotnet ef database update
on a Mac? This does seem like a bug if so.MackinnonBuck commentedon Mar 12, 2025
One fix would just be to move the
app.db
file from theData
folder to the root in the template. Alternatively, we could change the\\
to a/
, since that should work on Windows.skyslide22 commentedon Mar 12, 2025
Yes the
Data\app.db
file gets added when runningdotnet ef database update
or accessing http://localhost:5136/Account/Login and submit the form for example.