dotnet / dotnet/msbuild

NuGet static graph restore can cause subsequent builds to fail to expand globs in .NET SDK 6.0.100-preview6

Open
#6,602 21 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Issue Description

```
CSC : error CS2001: Source file 'D:\repos\runtime\src\coreclr\System.Private.CoreLib\*.analyzerdata.x64' could not be found. [D:\repos\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
CSC : error CS2001: Source file 'D:\repos\runtime\src\coreclr\System.Private.CoreLib\*.analyzerdata.net6.0' could not be found. [D:\repos\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
CSC : error CS2001: Source file 'D:\repos\runtime\src\coreclr\System.Private.CoreLib\*.analyzerdata.netcoreapp' could not be found. [D:\repos\runtime\src\coreclr\System.Private.CoreLib\System.Private.CoreLib.csproj]
```

The globbing of items in msbuild isn't expanded. These files are passed to the compiler as `AdditionalFiles` items. This was originally reported by @stephentoub.

### Steps to Reproduce

This should be easily reproducible by doing the same globbing as in the link below in a hello world app. Note that this seems to be dependent on the exact version of msbuild being used.

### Expected Behavior

The items specified in https://github.com/dotnet/arcade/blob/28a6403ee97077256fcdc60f599f0ad9e38e3cfa/src/Microsoft.DotNet.CodeAnalysis/build/Microsoft.DotNet.CodeAnalysis.targets#L21-L25 should be expanded correctly. The wildcard should be expanded and not hardcoded as a literal `*`.

### Actual Behavior

The wildcard globbing isn't expanded and the wildcard `*` is written literally.

![image](https://user-images.githubusercontent.com/7412651/122825620-7908e500-d2e2-11eb-8c82-88fd08329497.png)

### Analysis

### Versions & Configurations

MSBuild version = "17.0.0-preview-21317-11+c579afe9c"

### Attach a binlog

Internal link for MSFT employees:
https://microsofteur-my.sharepoint.com/:u:/g/personal/vihofer_microsoft_com/EftKjjkbyK5JvpaijHLKfjABIeIYvPIfQk_fIslqqn-rQA?e=suROf8

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the globbing behavior in a hello world app with MSBuild 17.0.0-preview-21317-11. Inspect the items in Microsoft.DotNet.CodeAnalysis.targets at lines 21-25 and compare static graph restore with subsequent builds. Done means the AdditionalFiles wildcards expand to matching items instead of reaching the compiler as literal * paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.