Question: How do you solve for an error in MVC AspNet 6 using Visual Studio 2022 that says "NotSupportedException: Path "wwwroot\MyFolder\MyFileName.Extension" was not rooted"? I am trying to download a file from this Folder Location.
Answer: When you are trying to download a file from a wwwroot folder make sure that you have right-clicked on the file in Visual Studio Solution Explorer and navigate to the Properties section. See steps below:
1. Navigate to Visual Studio 2022 Solution Explorer Section tab or Window.
2. Find the File you would want to access or download when the application gets started (on startup or runtime).
3. Right-click on the file and navigate to Properties Menu.
4. From the Slide-Out menu that shows up, select "Copy Always" on the Lable "Copy to Output Directory".
5. Bould your project again and verify that the file was indeed copied to the Bin Directory.
Other Similar Article