Prevent `dotnet pack --no-build` from triggering a build and causing NETSDK1085

Viewed 917

I expect that when running the following two commands, the latter will not trigger a new build:

  1. dotnet build solution.sln --configuration Release
  2. dotnet pack solution.sln --configuration Release --no-restore --no-build

However, since .NET Core SDK 3.0.100 the second command always fails for me with the following error:

C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.targets(133,5):
error NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked.

I guess it is a good thing that it fails the build since I indeed explicitly required it to not build. But why is a build being triggered despite --no-build?

What I'm actually trying to do is to code-sign (certificate, not strong naming) all built assemblies together in one go, before packing all of them into their NuGet packages:

  1. Build all projects of the solution, for all target frameworks
  2. Code-sign all assemblies in one go (so I don't have to enter the passphrase for every single assembly)
  3. Pack all projects of the solution to NuGet packages

That's also why it is important that pack does not trigger a new build and overwrite the signed assemblies.

Hence my question:

  • What could be triggering the build in the first place?
  • Or, how can I find out what is triggering the build in the first place?
0 Answers
Related