buga
buga

Reputation: 1364

publish to IIS local folder without iisreset

Every time I publish a blazor server app to a local folder, I get an error (Publish has encountered an error.)

if I don't call iisreset in advance

the tmp file with the error message says this:

12/21/2022 12:00:24 PM System.AggregateException: One or more errors occurred. ---> Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details. --- End of inner exception stack trace --- ---> (Inner Exception #0) Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.<---

Microsoft.WebTools.Shared.Exceptions.WebToolsException: Build failed. Check the Output window for more details.

===================

and in the output window I see lots of errors like:

Error MSB3021: Unable to copy file "...\WebUI\obj\Release\net7.0\PubTmp\Out\WebUi.dll" to "...\WebUi.dll". The process cannot access the file '...\WebUi.dll' because it is being used by another process.

Upvotes: 0

Views: 116

Answers (1)

Jason Pan
Jason Pan

Reputation: 22099

Please use Resource Monitor to check which process is using the WebUi.dll file.

You can End Process to check whether it works. And if you think this file shouldn't been used when you build or deploy the project. You can try to add below code in your .csproj file. For more details, you can check the link.

<GenerateResourceNeverLockTypeAssemblies>true</GenerateResourceNeverLockTypeAssemblies>

Upvotes: 1

Related Questions