When building my C# project, how can I switch to Release configuration in VS Code?
Right now I launch my application with Ctrl+F5
or Debug -> Start Without Debugging
which also builds it, but this creates only a debug build at bin/Debug
. There is no Build
menu in VS Code.
Here's my tasks.json:
{ "version": "2.0.0", "tasks": [ { "taskName": "build", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/dotnetcore-test.csproj" ], "problemMatcher": "$msCompile" } ] }
A release build uses optimizations. When you use optimizations to create a release build, the compiler will not produce symbolic debugging information.
Major differences are the debug apk and the release apk: For debug builds the apk will be signed with the default debug signing keys with debug flag enabled. For release apk you will have to explicitly specify the apk to sign with and the debug flag will be turned off so that it cannot be debugged.
To generate a release build of your programSelect Release from the Solution Configuration drop-down list, which is on the Standard toolbar. On the Build menu, click Build.
edit the task.json like this:
{ "version": "2.0.0", "tasks": [ { "taskName": "build Debug", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/dotnetcore-test.csproj" ], "problemMatcher": "$msCompile" }, { "taskName": "build Release", "command": "dotnet", "type": "process", "args": [ "build", "${workspaceFolder}/dotnetcore-test.csproj", "-c", "Release" ], "problemMatcher": "$msCompile" } ] }
then when you press Ctrl+Shift+B
the Command Palette
will let you choose between Build Release
and Build Debug
source: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-build?tabs=netcore2x
You can perform a release build via the terminal with:
dotnet build -c release
If you want to run in release, use:
dotnet run -c release
Source: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With