Allow running `dotnet app.exe` instead of `dotnet app.dll`
See original GitHub issueWhen 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:
- Created 2 years ago
- Comments:7 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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).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.