Skip to content

Under SDK version >= 8.0.300 many NuGet-related properties are no longer set during evaluation #10504

@EduardSergeev

Description

@EduardSergeev

Issue Description

There seems to be a breaking change introduced in .NET SDK starting from version 8.0.300:
During the evaluation stage of the build many NuGet-related properties are no longer populated, for example $(NugetPackageRoot) or $(NuGetPackageFolder) are missing.

For example when the same project is build using dotnet build -bl the following NuGet* properties are present in Evaluation stage:
With SDK 8.0.206:
image

While with SDK 8.0.303 only:
image
(note missing $(NugetPackageRoot))

I could not find any relevant information regarding this breaking change (our build is broken since we were relying on $(NugetPackageRoot) being set) in release notes so I was wondering if it is undocumented change or a bug? And if there is a way to restore a previous behavior with SDK 8.0.303?

Steps to Reproduce

The following minimal project demonstrates the change in behavior:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
  </PropertyGroup>
  <Target Name="CheckProperty" BeforeTargets="Restore">
    <Message Text="NugetPackageRoot: $(NugetPackageRoot)" Importance="high" />
  </Target>
</Project>

Expected Behavior

When built using dotnet build command from SDK 8.0.206 the following output is produced:

$ dotnet build
MSBuild version 17.9.8+610b4d3b5 for .NET
  Determining projects to restore...
  NugetPackageRoot: /home/eduard/.nuget/packages/
  Restored /home/eduard/codeir/ir-grpc/src/Test/Test.csproj (in 78 ms).
  Test -> /home/eduard/codeir/ir-grpc/src/Test/bin/Debug/net8.0/Test.dll

The same output is expected under SDK 8.0.300.

Actual Behavior

When built using dotnet build command from SDK 8.0.300:

$ dotnet build
  Determining projects to restore...
  NugetPackageRoot:
  All projects are up-to-date for restore.
  Test -> /home/eduard/codeir/ir-grpc/src/Test/bin/Debug/net8.0/Test.dll

Ask us questions

Is it undocumented change or a bug? And if there is a way to restore a previous behavior with SDK 8.0.303?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions