dotnet / dotnet/msbuild

Get the renamed Platform passed in from command-line

Open
#4,752 15 comments 4 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

### Steps to reproduce
It is allowed to renamed a platform from "AnyCPU, x86, x64" to a customized name for a solution, such that we can build with a specific platform with command like:

`msbuild MSBuildTests.sln -p:Platform=MyPlatform1;Configuration=MyConfig1`

We can get MyConfig1 from `$(Configuration)` in a `.csproj`, However, there is no way to get the `MyPlatform1` argument from `$(Platform)` as it is overwritten by `x64` (assume it is renamed from x64).

There should be a way to get the renamed platform that passed in from command-line when we build on a `.sln`. Or we already have it?

Project file
```xml


Exe
netcoreapp2.1
AnyCPU;x64



```

Directory contents:
```
/
- MSBuildTests.sln
- MSbuildTests/
- c.cs
- MSBuildTests.csproj
```

Command line
```
`msbuild MSbuildTests.sln -p:platform=MyPlatform1 -t:GetRenamedPlatform`
```
### Expected behavior
Print "MyPlatform1"

### Actual behavior
Print "x64"

### Environment data
`msbuild /version` output:
Microsoft (R) Build Engine version 16.2.37902+b5aaefc9f for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

16.2.37902.0

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.