stavroskasidis/BlazorWasmAntivirusProtection

Publishing obfuscates the wrong files

FiddlerKing opened this issue · 4 comments

We are experiencing the same phenomenon as described in this issue: Build errors after referencing this package

Referencing this package and making the first publish all builds fails after that.

It doesn't matter if we publish from VS 2022 or from the command line.

What happens is that when we publish the project this package obfuscates the wrong files, it obfuscates the files in the nuget-cache folder and not the actual published files.

BlazorWasmAntivirusProtection: Xor'ed dll C:\Users\xxxxx\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.5\runtimes\browser-wasm\lib\net6.0\System.Security.dll
BlazorWasmAntivirusProtection: Xor'ed dll C:\Users\xxxxx\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.5\runtimes\browser-wasm\lib\net6.0\System.Security.Principal.dll
BlazorWasmAntivirusProtection: Xor'ed dll C:\Users\xxxxx\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.5\runtimes\browser-wasm\lib\net6.0\System.Security.Principal.Windows.dll
BlazorWasmAntivirusProtection: Xor'ed dll C:\Users\xxxxx\.nuget\packages\microsoft.netcore.app.runtime.mono.browser-wasm\6.0.5\runtimes\browser-wasm\lib\net6.0\System.Security.SecureString.dll

To be able to make a new build, we have to remove all files from the nuget-cache folder.

Using VS 2022, Net 6.03 and version 1.8 of this package. Doing a Release publish to local folder.

Any suggestions?

I have no idea how that would happen.

The code is getting a list of

public ITaskItem[] PublishBlazorBootStaticWebAsset { get; set; }

passed on by the blazor ms build tasks, and running the obfuscation against them.

It seems that for some reason it is using the cache folder dll instead of the copies inside the obj folder.
A project that reproduces this behavior would help me solve this, since I cannot reproduce locally.

Here is a copy of your own SampleApp, slightly modified to use Net 6.0.3 and the release version of 1.8

In VS 2022 create a publishing profile that publishes to a folder using the suggested folder. Then hit publish. Version of VS used was 17.1.2

BlazorHostedSampleApp.zip

It seems that the <PublishTrimmed> tag in the project is the culprit.

Let me know if there is anything more needed.

Thank you. That helps me a lot. I will track down the issue and try to come up with a solution

I have identified the issue but I am not sure how to solve it. It seems that to fix this either a tremendous amount of work is required or having more knowledge about the Blazor msbuild pipeline (that I am lacking). I am going to leave this issue open and add it to the documentation as a known issue (false is not supported)