加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 在Visual Studio代码中发布版本

发布时间:2020-12-15 23:41:34 所属栏目:百科 来源:网络整理
导读:在构建我的C#项目时,如何在VS Code中切换到Release配置? 现在我用Ctrl F5或Debug启动我的应用程序 – Start Without Debugging也可以构建它,但是这只会在bin / Debug中创建一个调试版本. VS代码中没有“生成”菜单. 这是我的tasks.json: { "version": "2.0
在构建我的C#项目时,如何在VS Code中切换到Release配置?

现在我用Ctrl F5或Debug启动我的应用程序 – > Start Without Debugging也可以构建它,但是这只会在bin / Debug中创建一个调试版本. VS代码中没有“生成”菜单.

这是我的tasks.json:

{
    "version": "2.0.0","tasks": [
        {
            "taskName": "build","command": "dotnet","type": "process","args": [
                "build","${workspaceFolder}/dotnetcore-test.csproj"
            ],"problemMatcher": "$msCompile"
        }
    ]
}

解决方法

像这样编辑task.json:

{
    "version": "2.0.0","tasks": [
        {
            "taskName": "build Debug","problemMatcher": "$msCompile"
        },{
            "taskName": "build Release","${workspaceFolder}/dotnetcore-test.csproj","-c","Release"
            ],"problemMatcher": "$msCompile"
        }        
    ]
}

然后当您按Ctrl Shift B时,Command Palette将允许您在Build Release和Build Debug之间进行选择

资源:
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-build?tabs=netcore2x

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读