Reputation: 29985
I created a new project in Visual Studio 2019 and named it SimpleCSharpApp
. Wrote a simple HelloWorld application and compiled in Debug Mode. Now I need the executable (the .exe
file to be more exact). It is supposed to be in SimpleCSharpApp/bin/Debug
, but it isn't there. There's a single directory named netcoreapp2.1
which contains the following files:
SimpleCSharpApp.deps.json
SimpleCSharpApp.dll
SimpleCSharpApp.pdb
SimpleCSharpApp.runtimeconfig.dev.json
SimpleCSharpApp.runtimeconfig.json
How can I find the executable?
Upvotes: 1
Views: 2304
Reputation: 3826
I assume it's a dotnet core app since there is folder named netcoreapp2.1
.
at the root of your project execute the following command to publish your app with executable files:
dotnet publish -c Release -r <RID> --self-contained false
RID is the runtime identitfier, such as win-x64 or whatever platform you want to have build for.
If you want to get DLL then :
dotnet yourappname.dll
The "dll" file works across different platforms that are supported by the .net core runtime such windows, linux, and macOS.
If you want to get the executable file on every Visual Studio build without firing any command, then edit your .csproj
file by adding the following line between <PropertyGroup></PropertyGroup>
section:
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
now when you build there is a folder called win10-x64
inside netcoreapp2.1
that contains the executable.
Upvotes: 4