devlooped / nugetizer

A simple to understand packing model for authoring NuGet packages
https://clarius.org/nugetizer/
MIT License
254 stars 7 forks source link

error NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. #407

Closed voroninp closed 1 year ago

voroninp commented 1 year ago

My TeamCity build definition contains dotnet pack command with --no-build modifier, and this step fails with error:

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

It looks like NuGetizer tries to rebuild referenced project:

Target "ResolveProjectReferences"
22:18:47              1>Target "ResolveProjectReferences" in file "C:\Program Files\dotnet\sdk\7.0.102\Microsoft.Common.CurrentVersion.targets" from project "C:\BuildAgents\Agent03\work\9efa6ed76414e7bd\MBS.Logging.SimpleInjector\MBS.Logging.SimpleInjector.csproj" (target "ResolveReferences" depends on it):
22:18:47                Task "MSBuild" skipped, due to false condition; ('%(_MSBuildProjectReferenceExistent.BuildReference)' == 'true' and '@(ProjectReferenceWithConfiguration)' != '' and ('$(BuildingInsideVisualStudio)' == 'true' or '$(BuildProjectReferences)' != 'true') and '$(VisualStudioVersion)' != '10.0' and '@(_MSBuildProjectReferenceExistent)' != '') was evaluated as ('true' == 'true' and '..\MBS.Logging\MBS.Logging.csproj' != '' and ('false' == 'true' or 'true' != 'true') and '17.0' != '10.0' and '..\MBS.Logging\MBS.Logging.csproj' != '').
22:18:47                Task "MSBuild"
22:18:47                  Removing Properties for project "..\MBS.Logging\MBS.Logging.csproj":
22:18:47                    TargetFramework
22:18:47                    RuntimeIdentifier
22:18:47                    SelfContained
22:18:47         Project "MBS.Logging.csproj"
22:18:47              1>Done executing task "MSBuild" -- FAILED.
22:18:47              1>Done building target "ResolveProjectReferences" in project "MBS.Logging.SimpleInjector.csproj" -- FAILED.

If I remove --no-build everthing works fine.

kzu commented 1 year ago

Please consider sponsoring @devlooped to bump the priority on this issue. Thanks 🙏!

voroninp commented 1 year ago

@kzu , done.

kzu commented 1 year ago

Hi @voroninp! Could you please try the PR build to verify the fix solves the issue for you?

You can install the PR package by using the https://pkg.kzu.dev/index.json and version 42.42.42-pr407. For example:

dotnet add package NuGetizer -v 42.42.1084-pr413 -s https://pkg.kzu.dev/index.json
voroninp commented 1 year ago

@kzu , I'll take a look today. Thanks