dotnet / dotnet/msbuild

--graph --isolate build fails due to injected MSBuildProjectInstanceae5e33657bcf4b709f00d8192e8a00d2 global property

Open
#6,857 0 comments 0 reactions 1 assignee Claimed by @cdmihai View on GitHub
Area: Static Graph bug has-repro triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

A not-too-complicated repo fails with isolated graph builds due to an injected msbuild global property.

### Steps to Reproduce

```
git clone https://github.com/microsoft/vs-threading.git
cd vs-threading
git checkout bugrepro/msbuild/6857
.\init.ps1
dotnet build --graph --isolate --no-restore test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj
```

### Expected Behavior

The build succeeds.

### Actual Behavior

The build fails with
```
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : MSB4252: Project "C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj" with global properties [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : (IsGraphBuild=true) [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : is building project "C:\git\threading\src\Microsoft.VisualStudio.Threading\Microsoft.VisualStudio.Threading.csproj" with global properties [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : (IsGraphBuild=true; TargetFramework=net472) [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : with the (default) target(s) but the build result for the built project is not in the engine cache. In isolated builds this could mean one of the following: [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : - the reference was called with a target which is not specified in the ProjectReferenceTargets item in project "C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj" [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : - the reference was called with global properties that do not match the static graph inferred nodes [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : - the reference was not explicitly specified as a ProjectReference item in project "C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj" [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
C:\Users\andarno\.dotnet\sdk\5.0.400\Microsoft.Common.CurrentVersion.targets(1924,5): error : [C:\git\threading\test\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher\Microsoft.VisualStudio.Threading.Tests.Win7RegistryWatcher.csproj]
```

### Analysis

@rainersigwald already investigated and found:

> I looked into your issue 2 where -isolate complains about an edge. The reason for the complaint is that the real build has an injected uniqueness property

```
Properties
Global
Configuration = Debug
Platform = AnyCPU
IsGraphBuild = true
TargetFramework = net472
MSBuildProjectInstanceae5e33657bcf4b709f00d8192e8a00d2 = Forces unique project identity in the MSBuild engine
```

### Versions & Configurations

```
dotnet --version
5.0.400
```

### Attach a binlog

[binlog](https://microsoft-my.sharepoint.com/:u:/p/andarno/EWHzSCsdOn9ErKSRiZbznfYBi43mRMwXwNj-kmV0w9Oi-A?e=yEqiJY)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.