dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.

Home Page:https://docs.microsoft.com/visualstudio/msbuild/msbuild

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: Artifacts are placed in directory of lowest `Directory.Build.props` if more than one is present

just-ero opened this issue · comments

commented

Issue Description

I import ./Directory.Build.props into ./src/Directory.Build.props. In ./Directory.Build.props, I set ArtifactsOutputPath to $(MSBuildThisFileDirectory)\artifacts. This causes a ./src/artifacts directory to be used for the artifacts of the projects in ./src. I don't want this, I want all artifacts to be placed in ./artifacts.

Steps to Reproduce

  1. Create or open any project.
  2. Create or open ./Directory.Build.props, add the following to it:
    <Project>
    
      <PropertyGroup>
        <UseArtifactsOutput>true</UseArtifactsOutput>
        <ArtifactsOutputPath>$(MSBuildThisFileDirectory)\artifacts</ArtifactsOutputPath>
      </PropertyGroup>
    
    </Project>
  3. Create or open ./src/Directory.Build.props, add the following to it:
    <Project>
    
      <Import Project="$([MSBuild]::GetPathOfFileAbove('$(MSBuildThisFile)', '$(MSBuildThisFileDirectory)\..'))" />
    
    </Project>
  4. Build any project in ./src/*.
  5. Observe ./src/artifacts being used for the build results.

Expected Behavior

Artifacts are placed in ./artifacts.

Actual Behavior

Artifacts are placed in ./src/artifacts.

Analysis

No response

Versions & Configurations

dotnet --version: 8.0.204

commented

It's ArtifactsPath. That's embarrassing.