Project with multiple RuntimeIdentifiers is missing exe in Self Contained deployment
See original GitHub issueFrom @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
Issue Analytics
- State:
- Created 5 years ago
- Comments:19 (10 by maintainers)
Top Results From Across the Web
RuntimeIdentifiers and SelfContained - net core
I have set both RuntimeIdentifiers and SelfContained as below ... a semicolon-delimited list of Runtime Identifiers (RIDs) for the project.
Read more >Self-Contained Single-File does not produce a single file
I have set it up to publish as a self-contained single-file. However, in the publish directory is the EXE file and four DLLs....
Read more >Breaking change: Automatic RuntimeIdentifier - .NET
Learn about a breaking change in the .NET 7 SDK where a RuntimeIdentifier is automatically added to projects that use certain publish ...
Read more >Publishing multiple .NET Core applications in a single ...
[severity:Other] We have a solution that contains ~15 projects. 3 of the projects are setup to publish to the file system. 1 is...
Read more >Deploy Self-Contained .NET Apps Without Packaging the ...
Hi everyone! I just released version 2 of .NET Runtime Bootstrapper, which is packed with improvements. Check out the changelog here: ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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=Foo
todotnet publish
) at the appropriate time to allow the specified properties to be properly respected. Thus, properties like theRuntimeIdentifier
andUseAppHost
in 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\native
is 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.