dotnet / dotnet/wpf

Make `$(Architecture)` initialization resilient against pre-set values in `$env`

Open
#2,842 2 comments 1 reaction 0 assignees View on GitHub
Enhancement Requested
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

See https://github.com/cmderdev/cmder/issues/2290 for details.

> I was building [dotnet/wpf](https://github.com/dotnet/wpf) just now and noticed that it had trouble building correctly.
>
> I debugged it down to [these lines](https://github.com/dotnet/wpf/blob/878a6b748b66c6dc464dd50753fff5e5a2e6acdb/eng/WpfArcadeSdk/tools/Wpf.Cpp.props#L19-L21) that fail to initialize the MSBuild property `$(Architecture)` correctly (it's initialized to `64` instead of `x64`), which in turn lead to my (dev) build failures in **dotnet/wpf**.
>
> ```
> $(Platform)
> x86
> x64
> ```
>

**cmder** sets `$env:architecture` to values like `32`, `64`, which confuses this logic.

https://github.com/cmderdev/cmder/blob/1071221468f2f75f2b63e482deab69c9ca986219/vendor/init.bat#L125-L132
```
:: Pick right version of clink
if "%PROCESSOR_ARCHITECTURE%"=="x86" (
set architecture=86
set architecture_bits=32
) else (
set architecture=64
set architecture_bits=64
)
```

This only affects dev-builds, and only on some alternate-consoles. Still the fix is trivial and we can make this logic a bit resilient.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.