-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
(I may be misunderstanding how things are supposed to work here; apologies if this is more of a question than a bug.)
Consider the following project file:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net47</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<RuntimeIdentifier>win</RuntimeIdentifier>
</PropertyGroup>
</Project>This project builds/runs correctly and generates an AnyCPU exe. Now change the target framework to .NET Core:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<PlatformTarget>AnyCPU</PlatformTarget>
<RuntimeIdentifier>win</RuntimeIdentifier>
</PropertyGroup>
</Project>This project generates a build error:
Project is targeting runtime 'win' but did not resolve any runtime-specific packages for the 'Microsoft.NETCore.App' package. This runtime may not be supported by .NET Core.
If RuntimeIdentifier is win-x86 or win-x64, it builds, but at publish time I suspect (though couldn't confirm) that the assemblies it generates are not AnyCPU, even though the Platform in the project file was explicitly AnyCPU.
I believe .NET Core still supports AnyCPU for DLLs. But does it really support AnyCPU for EXEs? It looks like today there isn't a clear answer - you can say you're building an AnyCPU exe, but you don't actually get an exe unless you do publish on a Self-Contained Deployment by using a RuntimeIdentifier, and no AnyCPU RuntimeIdentifier (aka just "win"?) is currently supported.
How should this work? Should .NET Core allow creating AnyCPU EXEs? If not, should the build generate an error when OutputType=Exe and Platform=AnyCPU?