Azure Pipeline Build Error
AustinO
Posts: 1 New member
Hi there,
I have followed your guide Using SmartAssembly with Azure Pipelines - SmartAssembly 8 - Product Documentation (red-gate.com). I have the following tasks in my pipeline:
Some notes:
I have followed your guide Using SmartAssembly with Azure Pipelines - SmartAssembly 8 - Product Documentation (red-gate.com). I have the following tasks in my pipeline:
- SmartAssembly download (via NuGet custom command)
- SmartAssembly install (via PowerShell script)
- Use DotNet v3.1.100
- dotnet restore (.NET Core task)
- dotnet build (.NET Core task) <-- This fails here with error.
- SmartAssembly deactivation (via PowerShell script)
Some notes:
- Using SA8
- Project to obfuscate is a .NET Standard 2.1 project. It defines the .saproj file. My .csproj file also contains property
<SmartAssemblyOverwriteAssembly>True</SmartAssemblyOverwriteAssembly>
- Project is referenced by other .NET Core 3.1 projects in the same solution being built.
Unhandled exception. Microsoft.Build.Shared.InternalErrorException: MSB0001: Internal MSBuild Error: ContextID 4513 should have been in the ID-to-project file mapping but wasn't!
at Microsoft.Build.Shared.ErrorUtilities.ThrowInternalError(String message, Object[] args)
at Microsoft.Build.BackEnd.Logging.LoggingService.GetAndVerifyProjectFileFromContext(BuildEventContext context)
at Microsoft.Build.BackEnd.Logging.LoggingService.LogBuildEvent(BuildEventArgs buildEvent)
at Microsoft.Build.BackEnd.TaskHost.LogMessageEvent(BuildMessageEventArgs e)
at SmartAssembly.MSBuild.Tasks.LogTextWriter.WriteLine(String value)
at System.IO.TextWriter.WriteLine(String format, Object arg0, Object arg1)
at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object arg0, Object arg1)
at System.Console.WriteLine(String format, Object arg0, Object arg1)
at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
##[error]Error: The process 'C:\hostedtoolcache\windows\dotnet\dotnet.exe' failed with exit code 3762504530
##[warning].NET 5 has some compatibility issues with older Nuget versions(<=5.7), so if you are using an older Nuget version(and not dotnet cli) to restore, then the dotnet cli commands (e.g. dotnet build) which rely on such restored packages might fail. To mitigate such error, you can either: (1) - Use dotnet cli to restore, (2) - Use Nuget version 5.8 to restore, (3) - Use global.json using an older sdk version(<=3) to build
Info: Azure Pipelines hosted agents have been updated and now contain .Net 5.x SDK/Runtime along with the older .Net Core version which are currently lts. Unless you have locked down a SDK version for your project(s), 5.x SDK might be picked up which might have breaking behavior as compared to previous versions. You can learn more about the breaking changes here: https://docs.microsoft.com/en-us/dotnet/core/tools/ and https://docs.microsoft.com/en-us/dotnet/core/compatibility/ . To learn about more such changes and troubleshoot, refer here: https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/build/dotnet-core-cli?view=azure-devops#troubleshooting
##[error]Dotnet command failed with non-zero exit code on the following projects : \a\1\s\src\Foo.sln
Any idea what the issue could be? RedGate documentation says this is the recommended way to build & obfuscate:It's recommended to configure projects to run SmartAssembly during the build process (see Using SmartAssembly with MSBuild). Doing so allows you to skip SmartAssembly execution task entirely, as it will happen automatically when building your application with MSBuild.
..but at this point, I think I may just need to run the obfuscater manually post-build. Which sucks, why recommend this pattern if it doesn't work?