Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet --getProperty can sometime return more than one value #38944

Closed
spouliot opened this issue Feb 21, 2024 · 4 comments
Closed

dotnet --getProperty can sometime return more than one value #38944

spouliot opened this issue Feb 21, 2024 · 4 comments

Comments

@spouliot
Copy link

Describe the bug

dotnet --getProperty can sometime return more than one value.

This happens with 8.0.201 (on macOS at least) and was working properly (as expected) with 8.0.101.

To Reproduce

> dotnet new android
The template "Android Application" was created successfully.

> dotnet --version
8.0.201

> dotnet build --getProperty:OutputPath
bin\Debug/net8.0-android/
> dotnet build -r:android-arm64 --getProperty:OutputPath
bin\Debug/net8.0-android/android-arm64/
> dotnet build -r:android-arm64 --getProperty:OutputPath -f:net8.0-android
bin\Debug/net8.0-android/android-arm64/
bin\Debug/net8.0-android/android-arm64/

Create a global.json to use dotnet 8.0.101 and re-run the last command:

> dotnet build -r:android-arm64 --getProperty:OutputPath -f:net8.0-android
Build failed. Properties, Items, and Target results cannot be obtained. See details in stderr above.
bin\Debug/net8.0-android/android-arm64/

Disregard the build error (first line) but this prints only the value of OutputPath once.

Exceptions (if any)

This only seems to happen when -f is used.

This is needed for multi-platform projects like MAUI and Uno.

Further technical details

.NET SDK:
 Version:           8.0.201
 Commit:            4c2d78f037
 Workload version:  8.0.200-manifests.22889f84

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  14.3
 OS Platform: Darwin
 RID:         osx-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.201/

.NET workloads installed:
 [macos]
   Installation Source: SDK 8.0.200
   Manifest Version:    14.2.8022/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.macos/14.2.8022/WorkloadManifest.json
   Install Type:        FileBased

 [ios]
   Installation Source: SDK 8.0.200
   Manifest Version:    17.2.8022/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.ios/17.2.8022/WorkloadManifest.json
   Install Type:        FileBased

 [maccatalyst]
   Installation Source: SDK 8.0.200
   Manifest Version:    17.2.8022/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maccatalyst/17.2.8022/WorkloadManifest.json
   Install Type:        FileBased

 [maui]
   Installation Source: SDK 8.0.200
   Manifest Version:    8.0.6/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.maui/8.0.6/WorkloadManifest.json
   Install Type:        FileBased

 [android]
   Installation Source: SDK 8.0.200
   Manifest Version:    34.0.79/8.0.100
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100/microsoft.net.sdk.android/34.0.79/WorkloadManifest.json
   Install Type:        FileBased


Host:
  Version:      8.0.2
  Architecture: arm64
  Commit:       1381d5ebd2

.NET SDKs installed:
  6.0.404 [/usr/local/share/dotnet/sdk]
  6.0.408 [/usr/local/share/dotnet/sdk]
  6.0.410 [/usr/local/share/dotnet/sdk]
  7.0.101 [/usr/local/share/dotnet/sdk]
  7.0.105 [/usr/local/share/dotnet/sdk]
  7.0.203 [/usr/local/share/dotnet/sdk]
  7.0.302 [/usr/local/share/dotnet/sdk]
  7.0.304 [/usr/local/share/dotnet/sdk]
  7.0.306 [/usr/local/share/dotnet/sdk]
  7.0.401 [/usr/local/share/dotnet/sdk]
  8.0.100-preview.7.23376.3 [/usr/local/share/dotnet/sdk]
  8.0.100-rc.1.23455.8 [/usr/local/share/dotnet/sdk]
  8.0.100 [/usr/local/share/dotnet/sdk]
  8.0.101 [/usr/local/share/dotnet/sdk]
  8.0.201 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-rc.1.23421.29 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.16 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.11 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-rc.1.23419.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download
@baronfel
Copy link
Member

I think I'm seeing this as well in #38811, where I'm trying to use it to do testing. This issue should move to dotnet/msbuild though. I'll transfer.

@baronfel baronfel transferred this issue from dotnet/sdk Feb 21, 2024
@baronfel
Copy link
Member

Interesting note that -f is a requirement here - is the inner/outer build check in the SDK targets to blame here?

@ladipro
Copy link
Member

ladipro commented Feb 22, 2024

With -f, MSBuild is invoked twice:
-maxcpucount -verbosity:m -target:Restore -property:RuntimeIdentifier=android-arm64 -property:_CommandLineDefinedRuntimeIdentifier=true --getProperty:OutputPath <loggers>
and
-maxcpucount -verbosity:m -nologo -consoleloggerparameters:Summary -property:TargetFramework=net8.0-android -property:RuntimeIdentifier=android-arm64 -property:_CommandLineDefinedRuntimeIdentifier=true --getProperty:OutputPath <loggers>

Without -f, it is invoked only once:
-maxcpucount -verbosity:m -restore -consoleloggerparameters:Summary -property:RuntimeIdentifier=android-arm64 -property:_CommandLineDefinedRuntimeIdentifier=true --getProperty:OutputPath <loggers>

The reason why it appeared to work as expected in 8.0.100 is dotnet/msbuild#9339 which was fixed in 8.0.200. The Build failed. ... output is actually relevant.

@baronfel I'm afraid this should go back to dotnet/sdk as these are unexpected interactions between restore and the new switches.

@baronfel baronfel transferred this issue from dotnet/msbuild Feb 22, 2024
@baronfel
Copy link
Member

This is fixed in the 8.0.3xx nightlies, and will go out with I believe the April build of the 8.0.2xx series at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants