Microsoft.NET.Sdk.StaticWebAssets.targets unable to publish when static web assets been removed after build phase #56755
Labels
area-blazor
Includes: Blazor, Razor Components
✔️ Resolution: Answered
Resolved because the question asked by the original author has been answered.
question
Status: Resolved
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
I have an ASP․NET Core Web API project. I'd like to add front-end files to the
wwwroot
folder during publish the project to the output directory.Assume that I have a
wwwroot\.gitkeep
file in the project.During
dotnet build
, no files will be copy to thewwwroot\
folder.I defined a Target to remove all files from
wwwroot\
folder and copy all related files from another folder to thewwwroot\
folder which run beforeStaticWebAssetsPrepareForPublish
target.When I run
dotnet publish
, I will get an error like this:error MSB3030: Could not copy the file "D:\a\1\s\my-project\wwwroot\.gitkeep" because it was not found. [D:\a\1\s\my-project\my-project.csproj]
.It seems all files existed in the build phase can't be removed during publish.
Describe the solution you'd like
I'd like to have a feature that can add/remove static files to the
wwwroot
folder during publish.Additional context
N/A
The text was updated successfully, but these errors were encountered: