Could not load file or assembly SmartAssembly.MSBuild.Tasks
matilote
Posts: 2 New member
Hi there,
We are trying to automate obfuscation with MSBuild integration, we are able to obfuscate manually via GUI. When adding additional code to a csproj file we receive an error just as below:
error MSB4062: Culture=neutral, PublicKeyToken=7f465a1c156d4d57. Could not load file or assembly 'SmartAssembly.MSBuild.Tasks, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7f465a1c156d4d57'.
We've followed these instructions accordingly: https://documentation.red-gate.com/sa7/building-your-assembly/using-smartassembly-with-msbuild?_ga=2.260650253.1219834847.1565511253-1957869546.1565267750
note: we are testing the trial version
We are trying to automate obfuscation with MSBuild integration, we are able to obfuscate manually via GUI. When adding additional code to a csproj file we receive an error just as below:
error MSB4062: Culture=neutral, PublicKeyToken=7f465a1c156d4d57. Could not load file or assembly 'SmartAssembly.MSBuild.Tasks, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7f465a1c156d4d57'.
We've followed these instructions accordingly: https://documentation.red-gate.com/sa7/building-your-assembly/using-smartassembly-with-msbuild?_ga=2.260650253.1219834847.1565511253-1957869546.1565267750
note: we are testing the trial version
Tagged:
Answers
Can you please confirm that you have SmartAssembly 7 installed on the machine where the build is occurring? Please also let me know the specific build of SmartAssembly 7 it is.
Kind regards,
Alex
Have you visited our Help Center?
Yes, SA 7 is installed on the machine.
This is how does our csproj file look like.
I am not able to share saproj, but it works to build an obfuscated file manually, so the error must lay somewhere in the csproj file below.
<Project Sdk="Microsoft.NET.Sdk">
I've just done a quick test with a console application targetting .Net Core 2.2 and it has worked for me:
The only difference that I can see is that you have the <ItemGroup> between the two parts of the SmartAssembly task... if you rearrange this so that it is the entire SmartAssembly task portion pasted in as the last part of the csproj (before the end </Project> tag) does it behave any differently?
Also what specific version of SA7 do you have installed? I'm using 7.0.7 in the image and I've updated to 7.0.8 and it works there as well.
Kind regards,
Alex
Have you visited our Help Center?