When I take fish.exe to my Windows machine, it will not run and gives unhappy errors. I discover that I only have .NET 6 and 7 on my windows machine, whereas I am using .NET 8 on my Fedora machine. But there is more to the problem that this. Even when I install .NET 8 on my windows machine I keep getting the error and it seems to still be running .NET 7. This is as yet an unsolved problem. For the play by play as this developed, follow along.
cd Fish dotnet build -r win-x64 dotnet publish -c release -r win-x64Very much to my surprise this works! I expected to have to find and install a win-x64 runtime.
cd Fish/bin/release/net8.0/win-x86 ls -l -rw-r--r-- 1 tom tom 4608 Sep 6 15:14 fish.dll -rwxr-xr-x 1 tom tom 110592 Sep 6 15:14 fish.exeBoth of these are different in size than the linux versions. However when I try this on my Windows 10 system, I again get:
A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files (x86)\do tnet\'. Failed to run as a self-contained app. - The application was run as a self-contained app because 'C:\Users\Tom\fish.runtimeconfig.json' was not found. - If this should be a framework-dependent app, add the 'C:\Users\Tom\fish.runtimeconfig.json' file and specify the appropriate framework.I poke around on the Windows system and find:
Directory of C:\Program Files\dotnet\shared\Microsoft.NETCore.App 06/22/2023 06:52 PMBoth of these directories have the hostpolicy.dll file.6.0.18 06/22/2023 06:55 PM 7.0.7
The clue is this line in my .csproj:
My build is targetting .NET 8 and my windows machine has only 6 and 7. The fix would be to install/update .NET Core on my windows machine. I get this on my windows machine:net8.0
dotnet --version 7.0.304It seems sort of funny that .NET is more up to date on my linux machine than on my windows machine. Indeed, .NET 8 was released on November 14, 2023. So how do we install it?
winget install Microsoft.DotNet.SDK.8I type this on the command line, but it complains that I should give my two letter country code (US) someplace
So I go back to the original page and select the .NET 8.0.8 runtime. I get an installer,
and run it. But again, I installed the wrong thing. I got the .NET.ASP thing, what I really
want is the .NET 8.0.8 runtime. So we have a third time a bat and try that.
This is sort of encouraging. I get:
tom@GILA C:\Program Files\dotnet\shared\Microsoft.NETCore.App>dir Directory of C:\Program Files\dotnet\shared\Microsoft.NETCore.App 06/22/2023 06:52 PMWe have the new runtime, and it does have hostpolicy.dll.6.0.18 06/22/2023 06:55 PM 7.0.7 09/06/2024 03:58 PM 8.0.8 5 Dir(s) 1,665,184,071,680 bytes free
My EXE still won't run, giving the same error -- and even after a reboot, I see this:
dotnet --version 7.0.304 cd C:\Program Files\dotnet dir Directory of C:\Program Files\dotnet 07/16/2024 09:05 PM 146,608 dotnet.exeWell, I just installed "dotnet" on 9-6-2024, so this version is old. I log out and log back in as an admin user. I uninstall then reinstall the .NET runtime.
I use the windows Start button, search for "add or remove programs", then find .NET things to eradicate. I get rid of:
.NET 8 ASP packageI was also ready to get rid of "NET 7.0.7 SDK", but then I spotted ".NET Version Manager" on the list. Let's give it a try first ... This is dated 2015, marked as "Beta", and the start menu cannot find it, so I don't think this has any merit.
I install the .NET desktop runtime, and now I see:
dotnet --list-runtimes Microsoft.AspNetCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] tom@GILA C:\Users\Tom\Downloads>dotnet --version 7.0.304I reboot the computer (this is often a necessary step with Windows. This had no benefit.
Tom's Computer Info / [email protected]