Console Application written in .NET 5.0 unable to run on colleague's computer

2

I wrote a tool at work in .NET 5.0 that I now have to give to a non-developer to use. Unfortunately, no matter how I publish it I can't get it to run on her computer. Currently I have it set at:

Configuration: Release | Any CPU
Target framework: net5.0
Deployment mode: Self-contained
Target runtime: win-x64 (checked that, she definitely has Windows 10 64-bit)

But when she runs it on her PC she gets:

Failed to load the dll from [C:\Users\username\Desktop\Release Builder\hostfxr.dll], HRESULT: 0x800700C1
The library hostfxr.dll was found, but loading it from C:\Users\username\Desktop\Release Builder\hostfxr.dll failed
  - Installing .NET prerequisites might help resolve this problem.
     https://go.microsoft.com/fwlink/?linkid=798306

I, of course, checked the link and she has above the minimum version of Windows 10. What gives? I'm use to either building web applications or just building console tools for myself. I figured self-contained would mean just handing over the contents of the publish folder.

I should point out, that the publish folder APPEARS to be correct... its over 230 files in there.

.net-core
windows-10
console-application
.net-5
asked on Stack Overflow May 6, 2021 by SonOfALink • edited May 6, 2021 by SonOfALink

1 Answer

2

Can you try to publish with these settings?

Step 1:

publish settings

Step 2: Open your .csproj and add these, or swap with yours.

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net5.0-windows</TargetFramework>
    <PublishReadyToRun>true</PublishReadyToRun>
    <PublishSingleFile>true</PublishSingleFile>
    <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <UseWPF>true</UseWPF>
    // keep other info
  </PropertyGroup>
answered on Stack Overflow May 6, 2021 by fatihyildizhan

User contributions licensed under CC BY-SA 3.0