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.

Default apphost should take platformtarget of app into account

See original GitHub issue

With x64 SDK on PATH:

  1. mkdir apphost
  2. cd apphost
  3. dotnet new console
  4. Edit apphost.csproj, set PlatformTarget to x86
  5. dotnet run (or execute bin\Debug\netcoreapp3.0\apphost.exe directly)
Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'D:\Temp\apphost\bin\Debug\netcoreapp3.0\apphost.dll'. An attempt was made to load a program with an incorrect format

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
peterhuenecommented, Nov 3, 2018

I think that RuntimeIdentifier is the “knob” for .NET Core. The problem here is that we have an implicit “runtime identifier” just for the apphost which only occurs when RuntimeIdentifier is not specified. The use of PlatformTarget would only help hint at the desired default architecture for the apphost in this case.

Ideally, this is going to be a temporary measure for 3.0 anyway. I don’t like having to restore for an additional runtime for “runtime agnostic” builds just to get the platform-specific apphost. This will be how it works for the first preview of 3.0, but I’m hoping to replace this before 3.0 releases with a better mechanism that doesn’t pollute your assets graph just to enable this.

2reactions
nguerreracommented, Oct 30, 2018

It occurs to me that fixing this will address a long-standing issue where F5 would use dotnet on path instead of dotnet with matching bitness. The default apphost can save us here. 😁

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common error troubleshooting for Azure App Service and ...
Provides troubleshooting advice for the most common errors when hosting ASP.NET Core apps on Azure Apps Service and IIS.
Read more >
Relationship between PlatformTarget and ...
In operation, you can specify Platform AnyCPU for building the app (indicating the app binary is appropriate for x86, x64, arm, etc., and...
Read more >
Using Package Management Format in Rider
The default way to install NuGet packages in classic projects is to use a packages.config file, which by default can be found near...
Read more >
Host ASP.NET Core on Windows with IIS
In web farm scenarios, an app can be configured to use a UNC path to store its data protection keyring. By default, the...
Read more >
Building Microsoft Teams app in C# and XAML with Uno ...
Click Modify and let the installer do its magic. In a few moments you will have the tools installed. Microsoft 365 Developer Program...
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