vscode中配置c#程序中的Configuration,使其输出在console.exe类型与classlib库类型之间切换

应用场景:最终目标是输出classlib库类型为dll,给js程序调用;但是中途需要可以断点调试。

最初做法是另外创建个console程序,引用目标类库,但是在vscode中不知道怎么断点调试引用的类库。

所以改成了二合一。

所以有了标题描述的需求,

tasks.json中,注意下方第11行👇

 1     "version": "2.0.0",
 2     "tasks": [
 3         {
 4             "label": "build",
 5             "command": "dotnet",
 6             "type": "process",
 7             "args": [
 8                 "build",
 9                 "${workspaceFolder}/amtf_sw.csproj",
10                 "/property:GenerateFullPaths=true",
11                 "/p:Configuration=exe方式",
12                 "/consoleloggerparameters:NoSummary"
13             ],
14             "problemMatcher": "$msCompile"
15         },

***.csproj文件中:

1   <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
2     <TargetFramework>netstandard2.0</TargetFramework>
3     <OutputPath>..\..\01js\其他\</OutputPath>
4   </PropertyGroup>
5   <PropertyGroup Condition=" '$(Configuration)' == 'exe方式' ">
6     <OutputType>Exe</OutputType>
7     <TargetFramework>netcoreapp3.1</TargetFramework>
8   </PropertyGroup>

 

posted @ 2023-03-12 21:10  老小鱼  阅读(83)  评论(0编辑  收藏  举报