-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Area: DocumentationIssues about docs, including errors and areas we should extend (this repo and learn.microsoft.com)Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com)Priority:2Work that is important, but not critical for the releaseWork that is important, but not critical for the releasetriaged
Description
Issue Description
Discovered in dotnet/BenchmarkDotNet#2664, passing /p:IntermediateOutputPath=
with an absolute path causes the exe of a referenced project to be overwritten by the project referencing it.
Steps to Reproduce
- Create a C# console app project
Console.WriteLine("Hello World from ConsoleApp1");
- Create a second C# console app project
Console.WriteLine("Hello World from ConsoleApp2");
- Add a project reference to the second project from the first project
<ItemGroup>
<ProjectReference Include="..\ConsoleApp2\ConsoleApp2.csproj" />
</ItemGroup>
- Build the project with dotnet sdk, passing absolute output paths.
dotnet build -c Release /p:IntermediateOutputPath=C:\Users\Tim\source\repos\BuildPathBug\obj/
- Run the produced
ConsoleApp2.exe
in the bin directory of ConsoleApp1.
Additional notes:
If I also include /p:OutDir=
so that both projects output to the same bin directory, the ConsoleApp2.exe
is correct if I do not include /p:IntermediateOutputPath=
, and incorrect if I do include it.
Likewise, with both /p:IntermediateOutputPath=
and /p:OutDir=
included, the ConsoleApp2.exe
is correct if I do not include the project reference in step 3, and incorrect if it is included.
Expected Behavior
Console prints Hello World from ConsoleApp2
.
Actual Behavior
Console prints Hello World from ConsoleApp1
.
Analysis
No response
Versions & Configurations
msbuild -version
Microsoft (R) Build Engine version 16.6.0 for Mono
Copyright (C) Microsoft Corporation. All rights reserved.
16.6.0.22901
dotnet --version
9.0.101
matthid and Nirmal4G
Metadata
Metadata
Assignees
Labels
Area: DocumentationIssues about docs, including errors and areas we should extend (this repo and learn.microsoft.com)Issues about docs, including errors and areas we should extend (this repo and learn.microsoft.com)Priority:2Work that is important, but not critical for the releaseWork that is important, but not critical for the releasetriaged