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.

Allow running `dotnet app.exe` instead of `dotnet app.dll`

See original GitHub issue

When I target net5.0 for an exe app, both app.dll and app.exe are published to output.

Running dotnet app.dll works fine, but running dotnet app.exe doesn’t work:

C:\MetadataTools>dotnet C:\MetadataTools\src\BinaryCompatChecker\bin\Debug\net5.0\BinaryCompatChecker.exe
Error:
  An assembly specified in the application dependencies manifest (BinaryCompatChecker.deps.json) has already been found but with a different file extension:
    package: 'BinaryCompatChecker', version: '1.0.0'
    path: 'BinaryCompatChecker.dll'
    previously found assembly: 'C:\MetadataTools\src\BinaryCompatChecker\bin\Debug\net5.0\BinaryCompatChecker.exe'

This is not a great experience: we know what the user wants, let’s just do the right thing.

The scenario is: an app is shipping both .dll and .exe. Some script runs the .exe. One should be able to prepend dotnet to run the .exe using .NET (by default it is run using Mono on Mac). Now I need to not only prepend dotnet, but also switch from .exe to .dll.

This is all very confusing for me, imagine how confusing it is for other users.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
agockecommented, Oct 29, 2021

I think the error message should be “app.exe is a native executable, not a .NET DLL. Native exes should not be executed with dotnet, but run directly.”

I disagree with the philosophy that we should “just run the exe” because it points to a potential confusion on the part of the user that doesn’t get corrected, it potentially lets through a bug in the case that the exe is not a managed app at all, and it biases a non-preferred scenario (using dotnet app.dll) over the preferred scenario (use the apphost).

0reactions
agockecommented, Oct 29, 2021

Nope, it’s a native binary. The default deployment experience for the SDK (on any platform) is OS-specific. Portable apps do not use the apphost.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build .Net Core as an EXE not a DLL
NET Core) and the other choice is Console App (.NET Framework) ... To produce an EXE instead of a DLL, you need a...
Read more >
NET application publishing overview
Publish an app as cross-platform and framework-dependent. An executable that targets your current platform is created along with the dll file.
Read more >
.Net Core 2.1 produces .dll instead of .exe & ...
I have a .NET Core. <Project Sdk="Microsoft.NET.Sdk">. Target framework = .NET Core 2.1. Output type = Console Application.
Read more >
dotnet run command - .NET CLI
The dotnet run command provides a convenient option to run your application from the source code.
Read more >
How to Create a .NET Core CLI Console App as an EXE ...
NET Core CLI tools it only produces a DLL by default. If you execute this: dotnet new console -n App. And then execute...
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