Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifacts output layout defined in Directory.build.props and disabled in project fail fails all dotnet commands #45953

Open
sqeezy opened this issue Jan 8, 2025 · 0 comments
Assignees
Labels
Area-NetSDK untriaged Request triage from a team member

Comments

@sqeezy
Copy link

sqeezy commented Jan 8, 2025

Issue Description

Repository with Reproduction

While updating to .NET 9 I encountered the following issue:

When activating artifacts path layout via Directory.build.props and disabling it in a project down the folder structure inside a csproj file. The system reacts to any build related command with:

MSBUILD : warning MSB5029: The value "/**" of the "Exclude" attribute in element <ItemGroup> in file "C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.props (36,62)" is a wildcard that results in enumerating all files on the drive, which was likely not intended. Check that referenced properties are always defined and that the project and current working directory are not at the drive root.
  FitnesseRunner failed with 1 error(s) (0.0s)
    C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.props(36,62): error MSB5029: The value "/**" of the "Exclude" attribute in element <ItemGroup> in file "C:\Program Files\dotnet\sdk\9.0.101\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.props (36,62)" is a wildcard that results in enumerating all files on the drive, which was likely not intended. Check that referenced properties are always defined and that the project and current working directory are not at the drive root.

Either using .NET 8 SDK or removing artifacts layout from Directory.build.props solves the issue.

I worked around it by placing an empty Directory.build.props file beside the project. This does not work when invoking commands on the project from somewhere else than the projects folder itself.

Steps to Reproduce

Example Command:
dotnet restore ConsoleApp

Folder Structure:

├── Directory.build.props
├── global.json
└── ConsoleApp
    ├── ConsoleApp.csproj

Directory.build.props

<Project>
  <!-- See https://aka.ms/dotnet/msbuild/customize for more details on customizing your build -->
  <PropertyGroup>

    <ArtifactsPath>$(MSBuildThisFileDirectory)artifacts</ArtifactsPath>

  </PropertyGroup>
</Project>

ConsoleApp.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>

    <UseArtifactsOutput>false</UseArtifactsOutput>
  </PropertyGroup>

</Project>

global.json

{
  "sdk": {
    "version": "9.0.100",
    "rollForward": "latestPatch"
  }
}

Expected Behavior

Restoring the packages.

Actual Behavior

error MSB5029

Analysis

No response

Versions & Configurations

Dotnet SDK 9.0.101

@maridematte maridematte transferred this issue from dotnet/msbuild Jan 14, 2025
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-NetSDK untriaged Request triage from a team member labels Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-NetSDK untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants