dotnet / dotnet/msbuild

[Bug]: `ResolveKeySource` is not a dependency of `CoreCompile`

Open
#10,306 4 comments 0 reactions 0 assignees View on GitHub
bug Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

`CoreCompile` target calls `Csc` with `KeyFile="$(KeyOriginatorFile)"`.
This `KeyOriginatorFile` property is set by the `ResolveKeySource` target.
`ResolveKeySource` target is not a dependency of `CoreCompile` (although it is a dependency of e.g., `Compile` and `CoreBuild`)
Most of the time it seems the `ResolveKeySource` target is actually executed before `CoreCompile` so everything works fine - but sometimes it doesn't: https://github.com/dotnet/roslyn/issues/74156

### Steps to Reproduce

1. Clone roslyn at 31e6ba81af842e960aa04850b0e63229874d4f02
2. Run `.\Restore.cmd`
3. Open in VS IntPreview Version 17.11.0 Preview 3.0 [35026.344.main]
4. Run Build > Build Solution - succeeds
5. Run Build > Build Solution again - fails - see https://github.com/dotnet/roslyn/issues/74156

Creating a minimal repro would be complicated, I don't know the exact conditions needed to get the buggy ordering of targets.

Here's the binlog (from a VS build) where I saw the issue: [vs.binlog.zip](https://github.com/user-attachments/files/16029277/vs.binlog.zip)

### Expected Behavior

Build succeeds the second time.

### Actual Behavior

```
CSC error CS8102: Public signing was specified and requires a public key, but no public key was specified. [D:\roslyn-D\src\VisualStudio\CSharp\Impl\Microsoft.VisualStudio.LanguageServices.CSharp.csproj]
```

### Analysis

_No response_

### Versions & Configurations

_No response_

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.