dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.7k stars 1.06k forks source link

Dotnet Build -t:Test with ReadyToRun currently not allowing project references and content references combined #30718

Open ivdiazsa opened 1 year ago

ivdiazsa commented 1 year ago

Describe the bug

When trying to run tests by means of the dotnet build -t:Test command using R2R, one must exclude any content references (dll references for instance) in the csproj file. Otherwise, the SDK fails when building.

To Reproduce

cd /path/to/runtime/repo
./build.sh -s clr+libs -c Release
cd src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests
<PublishReadyToRunExclude Include="System.Diagnostics.FileVersionInfo.TestAssembly.dll" />
dotnet build -c Release -t:Test -p:TestReadyToRun=true

Exceptions (if any)

/usr/local/share/dotnet/sdk/8.0.100-preview.1.23108.10/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(472,28): error MSB4094: "/path/to/runtime/repo/artifacts/bin/System.Diagnostics.FileVersionInfo.TestAssembly/Release/net8.0/System.Diagnostics.FileVersionInfo.TestAssembly.dll;/path/to/runtime/repo/artifacts/bin/System.Diagnostics.FileVersionInfo.TestAssembly/Release/net8.0/System.Diagnostics.FileVersionInfo.TestAssembly.dll" is an invalid value for the "CompilationEntry" parameter of the "RunReadyToRunCompiler" task. Multiple items cannot be passed into a parameter of type "Microsoft.Build.Framework.ITaskItem". [/path/to/runtime/repo/src/libraries/System.Diagnostics.FileVersionInfo/tests/System.Diagnostics.FileVersionInfo.Tests/System.Diagnostics.FileVersionInfo.Tests.csproj::TargetFramework=net8.0-unix]

Further technical details

.NET SDK:
 Version:   8.0.100-preview.1.23108.10
 Commit:    5725657a6b

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.2
 OS Platform: Darwin
 RID:         osx.13-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.100-preview.1.23108.10/

Host:
  Version:      8.0.0-preview.1.23106.5
  Architecture: arm64
  Commit:       9f654effb1

.NET SDKs installed:
  6.0.405 [/usr/local/share/dotnet/sdk]
  7.0.102 [/usr/local/share/dotnet/sdk]
  8.0.100-preview.1.23108.10 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.1.23107.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.13 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.1.23106.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  None

Environment variables:
  DOTNET_ROOT       [/usr/local/share/dotnet]

global.json file:
  Not found

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

Download .NET:
  https://aka.ms/dotnet/download
ivdiazsa commented 1 year ago

cc @MichalStrehovsky @davidwrighton