Artifacts output layout defined in Directory.build.props and disabled in project fail fails all dotnet commands #11243
Open
Description
Issue Description
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
Metadata
Assignees
Labels
No labels
Activity