sdk: Project with multiple RuntimeIdentifiers is missing exe in Self Contained deployment
From @Suchiman on December 13, 2018 17:20
With a csproj looking like
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
<AspNetCoreModuleName>AspNetCoreModule</AspNetCoreModuleName>
<AspNetCoreHostingModel>OutOfProcess</AspNetCoreHostingModel>
</PropertyGroup>
and a publish definition looking like
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp2.2</TargetFramework>
<ProjectGuid>33bc8379-5f2a-45eb-ae65-aa8cd2c62a72</ProjectGuid>
<DesktopBuildPackageLocation>$(BUILD_ARTIFACTSTAGINGDIRECTORY)\Project.zip</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath />
<PublishDatabaseSettings>
<Objects xmlns="" />
</PublishDatabaseSettings>
<SelfContained>true</SelfContained>
<UseAppHost>true</UseAppHost>
<_IsPortable>false</_IsPortable>
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
</PropertyGroup>
</Project>
Performing a publish will generate an self contained looking output except that the Project.exe is missing and there’s only a Project.dll
Changing
<RuntimeIdentifiers>win10-x64;win7-x86</RuntimeIdentifiers>
to
<RuntimeIdentifier>win7-x86</RuntimeIdentifier>
fixes this but has https://github.com/dotnet/core-setup/issues/4865 as a side effect
Copied from original issue: dotnet/core#2147
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (10 by maintainers)
The original issue should now be fixed in the latest 3.0 previews.
The .NET Core SDK now imports publish profiles (you can even pass
/p:PublishProfile=Footodotnet publish) at the appropriate time to allow the specified properties to be properly respected. Thus, properties like theRuntimeIdentifierandUseAppHostin the publish profile will work as expected.I’m going to close this issue as fixed. Feel free to reactivate if the latest .NET Core 3.0 preview does not address the issue.
@peterhuene yes,
.nuget\packages\runtime.win-x64.microsoft.netcore.dotnetapphost\2.2.0\runtimes\win-x64\nativeis empty so I think your ideas are correct except for the overzealous AV. There is no indication in my AV software that the files were blocked or quarantined, so my vote goes on the side of a failed restore leaving things in a corrupted state. It might even have been an issue with the corporate proxy blocking the download of the files.