dotnet / dotnet/sdk

Inconsistent casing of Configuration msbuild property when ArtifactsPath is set and unset

Open
#45,026 0 comments 1 reaction 0 assignees View on GitHub
Area-NetSDK
Dominant language
C#
Stars
3.2k
Forks
1.3k
PR merge metrics
PR metrics pending

Description

### Describe the bug

When the ArtifactsPath property is set the Configuration property is converted to lowercase (EG Debug becomes debug in paths)

https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DefaultOutputPaths.targets#L57
https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DefaultOutputPaths.targets#L92

When it is unset the same case set in the configuration definition is used (EG Debug remains Debug in paths).

This bit me when I was trying to work around https://github.com/dotnet/sdk/issues/41530 with a file copy but the inconsistent naming caused issues. I would suggest there should be a singular approach to casing rather than two.

### To Reproduce

```
dotnet build --configuration "Debug"
```

will produce bin/Debug in project folders

```
dotnet build --configuration "Debug" --artifacts-path build-output
```

will produce build-output/bin//debug

### Exceptions (if any)

### Further technical details

```
.NET SDK:
Version: 8.0.110
Commit: 87a66bb3d1
Workload version: 8.0.100-manifests.9143487c

Runtime Environment:
OS Name: ubuntu
OS Version: 22.04
OS Platform: Linux
RID: ubuntu.22.04-x64
Base Path: /usr/lib/dotnet/sdk/8.0.110/

.NET workloads installed:
Workload version: 8.0.100-manifests.9143487c
There are no installed workloads to display.

Host:
Version: 8.0.10
Architecture: x64
Commit: 81cabf2857

.NET SDKs installed:
8.0.110 [/usr/lib/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 8.0.10 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 8.0.10 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
None

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download
```

Workaround for anyone else who runs into this without being able to apply the patch to set artifact path via CLI if you define the property via msbuild (eg in a Directory.build.props)

```

$(MSBuildThisFileDirectory)\build-output

```

dotnet restore restores in the right place and uses the lowercase configuration in the path so at least all the commands produce consistent output.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.