10

I made a WPF and Console application for someone to use on their private server which I can't have access to. I used Visual Studio 2019's built-in "Publishing Wizard" to create Framework Dependant single-file apps. When the person opened the WPF app they were greeted with the standard warning:

A message box displaying the warning To run this application, you must install .Net Core. Would you like to download it now?

They clicked yes and to my understanding, they installed .Net Core 3.1 which is what the applications target.

After they restarted the computer they got the exact same warning again. I wasn't sure what was going on so I repackaged the apps as self-contained since the installed version of .Net Core was the same as what my applications were targeting.

That seemed to work for a little bit. We ran into some unrelated issues that I had to fix in the code on my end and then I re-published the projects and sent them out.

They tried to use the WPF application and they got the install warning again.

Now no matter what combination of options I pick in the "Publish Wizard" they keep getting the warning.

I'm not sure what to do.

Here's a picture of my publish settings

A picture describing the Profile Settings for publishing the WPF application.

Christopher Johnson
  • 635
  • 2
  • 7
  • 21
  • 1
    Have you tried it on any other Computers? Any Virtual Machines? Because if it only happens on one, it is propably something majorly wrong with that Computer. Might need a Windows reinstallation. – Christopher Dec 17 '19 at 03:03
  • Sadly no, I can ask the person to try that but it's out of my hands. – Christopher Johnson Dec 17 '19 at 03:04
  • 1
    This guy is running a Server, but obviously was incapable of giving you a proper screenshoot. That is a Phone Camera image - and also so zoomed in, we can not be sure if anything else is written on that message box. So I really suspect the issue is on his side. – Christopher Dec 17 '19 at 03:06
  • 1
    Simply hitting the `PrtScn` (Print Screen) button will take a screenshot of the desktop. Hitting `Ctrl+C` on a dialog box will copy the title, full text *and* button text. Right now, we can't even guess what the error message is - does the title ask for a *different* runtime version perhaps? – Panagiotis Kanavos Dec 17 '19 at 09:34
  • 1
    They should also run `dotnet --version` and send the result. – Panagiotis Kanavos Dec 17 '19 at 09:36
  • It's so weird. The title is just the app name, they tried it on their server and laptop with the same warning popping up again, they ran `dotnet --version` and the server is running `3.1.100` and the laptop was running `3.0.100`. For now I'm going to extract the logic into a .Net Framwork solution instead to get it up and going. – Christopher Johnson Dec 17 '19 at 15:55

2 Answers2

13

In my case I had the same issue, and the problem was that I was not deploying the file "MY_PROGRAM_NAME.runtimeconfig.json". After copying this file, which is present in the build output, the application is launched without problems.

Ernesto
  • 439
  • 4
  • 12
5

Turns out the issue was the fact that the applications were targeting win-x86 and the user only had access to 64-bit runtimes of .Net Core.

For some reason, I thought it would be able to handle a 32-bit version even if it was running 64-bit runtimes.

I guess live and learn.

Christopher Johnson
  • 635
  • 2
  • 7
  • 21
  • Did you try to install .Net Core 32 bit runtime? I did try this, but it was not helpful at all... – RudolfJan Jun 03 '20 at 08:12
  • 1
    @RudolfJan I'm going to assume I just targeted a 64-bit build, it's been a long time since this happened. – Christopher Johnson Jun 04 '20 at 09:27
  • 1
    Thanks for your reply. It still is confusing, but I think I got a working solution now, without really understanding what is going on... There is Publish option that allows to set a publish profile. It creates a long list of dll's to include, no idea why this is necessary and it provides a number of options for deployment. I may want to write down what I understand of it and then check if my understanding is correct. – RudolfJan Jun 04 '20 at 14:11
  • @But is It NetCore was included in your Self Content published file? – dellos Mar 31 '21 at 08:51
  • Dellos, this happened in 2019, I don't remember anything about this project. – Christopher Johnson Apr 01 '21 at 13:30
  • I have two x86 apps. One works, the other doesn't. I wonder what is missing. – TimTIM Wong Dec 06 '21 at 22:21
  • Oops, turns out my other project accidentally references ASP.NET Core which is not used. – TimTIM Wong Dec 06 '21 at 23:46