dotnet / dotnet/msbuild

"error CS0006: Metadata file '<snip>.dll' could not be found" in project with conditional projectreference

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

Description

In a solution that has a project with a conditional projectreference in one of the projects VS builds fail for me, but `dotnet build` doesn't.

### Steps to reproduce

Here is a sample solution:
[App.zip](https://github.com/Microsoft/msbuild/files/2304326/App.zip)

1. Open the solution with VS 2017 (15.8.0)
2. Rebuild the solution => fails
3. Edit LibA.csproj
4. Comment the existing conditional itemgroup
5. Uncomment the comment unconditional itemgroup
6. Rebuild the solution => Success!

### Expected behavior

VS build should succeed the same way dotnet build does

### Actual behavior

VS build seems to fail with conditional itemgroups and project references.

### Environment data
`msbuild /version` output:

```
Microsoft (R) Build Engine version 15.8.166+gd4e8d81a88 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

15.8.166.59604
```

`dotnet --info` output:

```
.NET Core SDK (reflecting any global.json):
Version: 2.1.400
Commit: 8642e60a0f

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.400\

Host (useful for support):
Version: 2.1.2
Commit: 811c3ce6c0

.NET Core SDKs installed:
1.1.6 [C:\Program Files\dotnet\sdk]
2.1.4 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
```

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.