dotnet / dotnet/msbuild

ResolveAssemblyReference looks for .dll from ConsoleApplication when /p:BuildProjectReferences is used

Open
#3,487 2 comments 2 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

### Steps to reproduce
create console app project c#,
create library project (unit tests)
reference console project in library project
try to build projects one by one using command line msbuild, i.e.:
```
msbuild /m /nologo /restore /t:build /p:Configuration=Release /p:BuildProjectReferences=false /p:OutDir="..\bin\Release" Application\Application.csproj
```
```
msbuild /m /nologo /restore /t:build /p:Configuration=Release /p:BuildProjectReferences=false /p:OutDir="..\bin\Release" ApplicationTests\ApplicationTests.csproj
```
The second will fail because of error:
```
CSC : error CS0006: Metadata file 'bin\Release\Application.dll' could not be found [ApplicationTests\ApplicationTests.csproj]
```

It looks that when **/p:BuildProjectReferences=false** is used, ResolveAssemblyReference assumes the referenced project assembly is .dll

The output from RAR step:
```
>ResolveAssemblyReferences:
Primary reference "Application".
Could not find dependent files. Expected file "bin\Release\Application.dll" does not exist.
Could not find dependent files. Expected file "bin\Release\Application.dll" does not exist.
Resolved file path is "bin\Release\Application.dll".
Reference found at search path location "".
The ImageRuntimeVersion for this reference is "".
```

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.