Closed oqo0 closed 11 months ago
@oqo0 thanks for contacting us.
Does the error go away if you rebuild the project?
@javiercn No, rebuilding doesn't help.
Could you also try to remove the bin
and obj
folders and see if the behavior perists?
If yes, then we will need a repro to investigate this further.
Thank you for filing this issue. In order for us to investigate this issue, please provide a minimal repro project that illustrates the problem without unnecessary code. Please share with us in a public GitHub repo because we cannot open ZIP attachments, and don't include any confidential content.
Could you also try to remove the
bin
andobj
folders and see if the behavior perists?
@mkArtakMSFT Deleting obj
fixed the issue. Thank you.
Still I'm not sure if this is a behaviour people would expect. When I removed UseStaticFiles
and wwwroot
it took me a while to realize that it's not an issue with my project.
@oqo0 thanks for the details. This is very likely and edge case issue with incrementalism on the build.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Is there an existing issue for this?
Describe the bug
After enabling static file serving and adding wwwroot to the .NET 7 project and then removing them an unhandled exception is created. It's despite the fact that no middleware or dependencies use wwwroot.
System.IO.DirectoryNotFoundException: project-path/wwwroot/
Expected Behavior
There should be no
DirectoryNotFoundException
.Steps To Reproduce
1) Create new .NET ASP.NET WebAPI (default template) 2) Launch it to see if everything works. 3) Enable static file serving in Program.cs
Also add empty
wwwroot
to your project. 4) Build and start the project. 5) Remove static file serving andwwwroot
from your project. Now we will getSystem.IO.DirectoryNotFoundException
even thought there are no middleware or dependencies that use wwwroot.Exceptions (if any)
System.IO.DirectoryNotFoundException
.NET Version
7.0.111
Anything else?
dotnet --info .NET SDK: Version: 7.0.111 Commit: 06c8b346e4
Runtime Environment: OS Name: fedora OS Version: 38 OS Platform: Linux RID: fedora.38-x64 Base Path: /usr/lib64/dotnet/sdk/7.0.111/
Host: Version: 7.0.11 Architecture: x64 Commit: ecb34f85ec
.NET SDKs installed: 6.0.122 [/usr/lib64/dotnet/sdk] 7.0.111 [/usr/lib64/dotnet/sdk]
.NET runtimes installed: Microsoft.AspNetCore.App 6.0.22 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.11 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.22 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.11 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]
Other architectures found: None
Environment variables: DOTNET_ROOT [/usr/lib64/dotnet]
global.json file: Not found