visual studio build c# as exe code example Example: c# compile into an exe dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true