Unable to launch custom .NET 6 BA with WixDotNetCoreBootstrapperApplicationHost in x64 - wix

I'm converting a WIX3/.NET4.8 installer to WIX4/.NET6. At the moment, I'm trying to see from the bundle our custom BA, which was converted to .NET6.
See previous question with more background
With the BA set to win-x64 (for both build and publishing self-contained) and to a dll output, I get the errors bellow.
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: You must install or update .NET to run this application.
App: C:\Windows\TEMP\{8521A191-8C06-4ED8-880A-4FE878955375}\.cr\visionCATS.exe
Architecture: x64
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: .NET location: C:\Windows\TEMP\{414A222D-3B83-4894-8FC0-5AD87CF921E3}\.ba\
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: No frameworks were found.
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr:
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=win10-x64
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: HostfxrInitializeForApp failed
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: Failed to initialize hostfxr.
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: The self-contained .NET Core runtime failed to load. This is an unrecoverable error.
[1E3C:08BC][2023-02-08T10:23:02]i000: Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x80008096.
My test application emulating WIX can also use the BA dll in x64, and the UI is displayed without issue on a VM without .NET6 runtime. It is only from the bundle itself that it isn't working.

Related

Unable to launch custom .NET 6 BA with WixDotNetCoreBootstrapperApplicationHost

I'm converting a WIX3/.NET4.8 installer to WIX4/.NET6. At the moment, I'm trying to see from the bundle our custom BA, which was converted to .NET6.
But I still get these errors on a fresh Win 11 VM, when launching the installer bundle:
Error 0x800700c1: Failed to load hostfxr from 'C:\Windows\TEMP\{2198BC7C-AA74-4DBC-A488-F62A6AD921AE}\.ba\hostfxr.dll'.
Error 0x800700c1: Failed to load hostfxr.
Error 0x800700c1: The self-contained .NET Core runtime failed to load. This is an unrecoverable error.
Bundle and BA settings:
the bundle use WIX 4.0.0-rc.2, and target x64
it has a BA with <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes"/>
the payload is harvested by heat, with the correct <Payload bal:BAFactoryAssembly="yes" SourceFile="$(var.InstallerUIPath)\VisionMainInstallerUI.exe" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" />
the custom BA is publish self-contained for runtime win-x86
the custom BA is targeting net6.0-windows/win-x86 (I discovered that x86 was still mandatory, as mbanative.dll is only x86)
As I have set the BA as executable (console) I'm able to launch it and see the console message from C:\Windows\TEMP{2198BC7C-AA74-4DBC-A488-F62A6AD921AE}.ba
I was previously creating a dll, but I had the same error, and the exe permit me to check that the self-contained is working and not missing anything.
I also tried the framework dependent solution, with installing the .NET runtime. But I get the same errors:
The prerequisites were successfully installed. The bootstrapper application will be reloaded.
Bootstrapper application requested to be reloaded.
Error 0x800700c1: Failed to load hostfxr from 'C:\Windows\TEMP\{6D909B1C-378D-4481-96DE-DCF7ADBDBBA4}\.ba\hostfxr.dll'.
Error 0x800700c1: Failed to load hostfxr.
Error 0x81f403ea: The prerequisites were already installed. The bootstrapper application will not be reloaded to prevent an infinite loop.
Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x81f403ea.
Finally, I also tried our test program, which emulate WIX for UI testing the BA: even in self-contained, without any runtime on the VM, the BA was correctly displayed.
Even if I struggle quite a bit to get the correct self-contained output, and the needed harvesting result, I have now a BA which is working when directly called, but WIX still don't want to start it. I now don't know what to do, as the errors messages are totally misleading (hostfxr.dll being present, and the BA is starting on its own).
Update
I switched again to win-x64 (for both build and publishing self-contained) and to a dll output, and I now get the errors bellow.
mbanative.dll correctly contains "PE\0\0d", therefore it is the 64 bit version (Dependencies GUI x64 misleads by marking an issue on it)
My test application emulating WIX can also use the BA dll in x64, and the UI is displayed without issue on a VM without .NET6 runtime. It is only from the bundle itself that it isn't working.
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: You must install or update .NET to run this application.
App: C:\Windows\TEMP\{8521A191-8C06-4ED8-880A-4FE878955375}\.cr\visionCATS.exe
Architecture: x64
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: Framework: 'Microsoft.NETCore.App', version '6.0.0' (x64)
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: .NET location: C:\Windows\TEMP\{414A222D-3B83-4894-8FC0-5AD87CF921E3}\.ba\
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr: No frameworks were found.
[1E3C:08BC][2023-02-08T10:23:02]e000: error from hostfxr:
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=6.0.0&arch=x64&rid=win10-x64
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: HostfxrInitializeForApp failed
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: Failed to initialize hostfxr.
[1E3C:08BC][2023-02-08T10:23:02]e000: Error 0x80008096: The self-contained .NET Core runtime failed to load. This is an unrecoverable error.
[1E3C:08BC][2023-02-08T10:23:02]i000: Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x80008096.
I discovered that x86 was still mandatory, as mbanative.dll is only x86
This is not correct. mbanative.dll is available in x86, x64, and ARM64. As long as your BA's project file is SDK-style, it's as simple as building with the win-x64 RID for an x64 bundle.
You must build your BA in the same architecture as the bundle. That's what 0x800700c1 (ERROR_BAD_EXE_FORMAT) is trying to tell you.

.NET Core 3.1 - dotnet ef add migration error

When I try to create a migration in my ASP.NET Core 3.1 MVC project, I get this error - I need help
Build started...
Build succeeded.
You must install or update .NET to run this application.
App: /Users/remzi/.dotnet/tools/.store/dotnet-ef/6.0.7/dotnet-ef/6.0.7/tools/net6.0/any/tools/netcoreapp2.0/any/ef.dll
Architecture: arm64
Framework: 'Microsoft.AspNetCore.App', version '3.1.0' (arm64)
.NET location: /usr/local/share/dotnet/
The following frameworks were found:
6.0.7 at [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Learn about framework resolution:
https://aka.ms/dotnet/app-launch-failed
To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.AspNetCore.App&framework_version=3.1.0&arch=arm64&rid=osx.12-arm64
Took me a lifetime to find the solution to this. 3.1 won't work because there is no arm64 version despite what it expects. To get around this you can force it to use this latest by typing the following into the terminal
export DOTNET_ROLL_FORWARD=LatestMajor

DotNetCore 2.2 App with IIS not working - HTTP Error 500.0 - ANCM In-Process Handler Load Failure

I have a DotNet Core 2.2 application that I am trying to get running through IIS. However, I get the following error: HTTP Error 500.0 - ANCM In-Process Handler Load Failure when I try to load the app in my browser.
Upon checking the logs it says the following:
Error:
An assembly specified in the application dependencies manifest (blablabla.deps.json) was not found:
package: 'AutoMapper.Extensions.Microsoft.DependencyInjection', version: '7.0.0'
path: 'lib/netstandard2.0/AutoMapper.Extensions.Microsoft.DependencyInjection.dll'
But I think that's a bit of a red herring.
The following is the output from dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 2.2.401
Commit: 729b316c13
Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.401\
Host (useful for support):
Version: 2.2.6
Commit: 7dac9b1b51
.NET Core SDKs installed:
2.2.401 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
I have tried all of the following:
Changed "AspNetCoreModuleV2" to "AspNetCoreModule" in the
Web.config.
Tried switching AspNetCoreHostingModel=InProcess to
RuntimeFrameworkName=Microsoft.AspNetCore.App in my Web.csproj file.
Cleaning and manually deleting the bin, obj, and .vs folders
My application pool is set to 'No Managed Code' (as the guides all say). At a bit of a loss regarding what to do as I've been through every forum post and github issue on the matter. Also, it is running on my colleagues machine whom has the exact same configuration as me.
One thing to note though, if he creates a copy of his application pool (same settings, basic and advanced, just a different name), and tries to run it on that, it doesn't work either and he gets the same error as me. It only works on the application pool called 'Core AppPool' which was automatically added to IIS upon installation of windows server hosting or the SDK (not sure which).
It seems your application pool identity don't have the enough permission to access your package folder.
I suggest you could try to set the package folder with enough permission by setting the folder's security.

msbuild GenerateDepsFile fails

All my projects are not failing to build on my Azure DevOps MacOS build host. It's a self-hosted build host. Suddenly, my projects are throwing this error when trying to build:
error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
error MSB4018: System.MissingMethodException: Method not found: System.Collections.Generic.IList`1<NuGet.Packaging.Core.PackageDependency> NuGet.ProjectModel.LockFileTargetLibrary.get_Dependencies()
I found this GitHub issue which seemed similar, but the posted solution didn't help me:
https://github.com/mono/mono/issues/13537
As mentioned in xamarin/xamarin-android#3155 this is caused by a version mismatch in nuget between msbuild and dotnet core. The solution is to update your dotnet core install to the latest stable version
I've installed the most recent .NET Core, and updated Visual Studio for Mac, but alas, the problem remains.
Another information:
When I build the same Xamarin.iOS project from my Windows machine coupled with the same MacOS build host, the app builds just fine. But I am guessing the process is probably different.
Updating both Visual Studio for Mac and .NET Core SDK again today seems to have fixed the problem.

Bootstrapper not loading on Windows Server 2008 r2

Hola Stackoverflowians
Testing my bootstrapper on Windows Server 2008, it doesn't launch, it just crashes with this log:
[07E8:0560][2013-07-16T11:36:31]e000: Error 0x80070002: Failed to create the managed bootstrapper application.
[07E8:0560][2013-07-16T11:36:31]e000: Error 0x80070002: Failed to create UX.
[07E8:0560][2013-07-16T11:36:31]e000: Error 0x80070002: Failed to load UX.
[07E8:0560][2013-07-16T11:36:31]e000: Error 0x80070002: Failed while running
[07E8:0560][2013-07-16T11:36:31]e000: Error 0x80070002: Failed to run per-user mode.
[07E8:0560][2013-07-16T11:36:31]i007: Exit code: 0x80070002, restarting: No
It's a completely clean installation of Windows, so it only has .NET 2.0 installed.
And my bootstrapper is built against 3.0 and I've got this in my BootstrapperCore.config
<supportedRuntime version="v2.0.50727" sku=".NETFramework,Version=v3.0" />
As far as my searches has gone, 0x80070002 = FILE_NOT_FOUND. "Which file is that?"
Using Process Monitor I couldn't see any File Not Found other than some .NET/System Restore components. None of which I expect to be there in this setup anyway, so ultimately this didn't help.
In this scenario (Current .net version < Required .net version) I would expect the prerequisites installer to kick in, but it doesn't.
Why doesn't the prereq installer start? And how does one go about debugging these type of errors with Burn? These messages aren't really all that helpful at all.
Thanks
EDIT: Does this mean you can not have a bootstrapper target .NET 3.0?