Artifacts output layout defined in Directory.build.props and disabled in project fail fails all dotnet commands
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Issue Description
[Repository with Reproduction](https://github.com/sqeezy/MSB5029-ArtifactsOutput-Bug)
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 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 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**
```xml
$(MSBuildThisFileDirectory)artifacts
```
**ConsoleApp.csproj**
```xml
Exe
net8.0
enable
enable
false
```
**global.json**
```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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.