dotnet / dotnet/project-system
Project properties build page shows incorrect platform target
- Dominant language
- C#
- Stars
- 1k
- Forks
- 415
- PR merge metrics
- No merged PRs in 30d
Description
Scenario: Create a .NET Core class library, and then change its Output Type to Windows Application. (This is useful among other reasons for running an integration test directly, because Test Explorer is so slow.)
Actual result: After you make the change, the Build page of the project properties shows Build Target as x86. However, when you run the executable, it actually runs as x64. This can cause mysterious BadImageFormatException exceptions.
Expected result: The Build page's Platform Target should show Any CPU or something to indicate that the project does not have a specified target.
_This issue has been moved from https://developercommunity.visualstudio.com/content/problem/175082/project-properties-build-page-shows-incorrect-plat.html
VSTS ticketId: 545711_
_These are the original issue comments:_
(no comments)
_These are the original issue solutions:_
Edward Brey solved on 1/1/2018, 07:49 AM (26 hours ago), 0 votes:
Once you discover that the problem is, the workarounds are pretty easy. You can change the target to some other value and then change it back.
Alternatively, you can add a runtime identifier to the .csproj. If you need your .exe to run as x86 so that it can load a x86 native DLL, add this element within a PropertyGroup:
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
A good place to put this is right after the TargetFramework or TargetFrameworks element.
Contributor guide
Assessment
This issue has not been assessed yet.