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 the wwwroot\ folder.
-
I defined a Target to remove all files from wwwroot\ folder and copy all related files from another folder to the wwwroot\ folder which run before StaticWebAssetsPrepareForPublish target.
<Target Name="NpmInstall" BeforeTargets="NpmRunBuild" Inputs="Client\package.json" Outputs="Client\node_modules\.package-lock.json">
<Exec Command="npm install --force" Condition="'$(RestorePackagesWithLockFile)' != 'true'"
WorkingDirectory="./Client" />
</Target>
<Target Name="NpmRunBuild" BeforeTargets="StaticWebAssetsPrepareForPublish" Inputs="Client\package.json" Outputs="wwwroot\index.html">
<Exec Command="npm run build:dev" WorkingDirectory="./Client" Condition="'$(Configuration)' == 'Release' and '$(EnvironmentName)' == 'Development'" />
<Exec Command="npm run build" WorkingDirectory="./Client" Condition="'$(Configuration)' == 'Release' and '$(EnvironmentName)' == 'Production'" />
</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
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
wwwrootfolder during publish the project to the output directory.Assume that I have a
wwwroot\.gitkeepfile 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 beforeStaticWebAssetsPrepareForPublishtarget.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
wwwrootfolder during publish.Additional context
N/A