question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Project with multiple RuntimeIdentifiers is missing exe in Self Contained deployment

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:19 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
peterhuenecommented, Aug 6, 2019

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 to dotnet publish) at the appropriate time to allow the specified properties to be properly respected. Thus, properties like the RuntimeIdentifier and UseAppHost 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.

1reaction
StillLearnincommented, May 6, 2019

@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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found