1
+ <Project DefaultTargets =" Build" >
2
+ <ItemGroup >
3
+ <ProjectFiles Include =" */*.csproj" />
4
+ </ItemGroup >
5
+ <PropertyGroup >
6
+ <LaunchOutput >./.vscode/launch.json</LaunchOutput >
7
+ <TasksOutput >./.vscode/tasks.json</TasksOutput >
8
+ <LaunchTemlate >
9
+ {
10
+ "name": "Launch PROJECT_NAME",
11
+ "type": "coreclr",
12
+ "request": "launch",
13
+ "preLaunchTask": "Build PROJECT_NAME",
14
+ "program": "OUTPUT_DLL",
15
+ "args": [],
16
+ "cwd": "OUTPUT_FOLDER",
17
+ "console": "internalConsole",
18
+ "stopAtEntry": false
19
+ },
20
+ </LaunchTemlate >
21
+ <TaskTemplate >
22
+ {
23
+ "label": "Build PROJECT_NAME",
24
+ "command": "dotnet",
25
+ "type": "process",
26
+ "args": [
27
+ "build",
28
+ "PROJECT_FILE",
29
+ "/property:GenerateFullPaths=true",
30
+ "/consoleloggerparameters:NoSummary;ForceNoAlign"
31
+ ],
32
+ "problemMatcher": "$msCompile"
33
+ },
34
+ </TaskTemplate >
35
+ </PropertyGroup >
36
+ <Target Name =" SetItemsMetadata" Inputs =" @(ProjectFiles)" Outputs =" %(Identity).DoesNotExist" >
37
+ <MSBuild Projects =" %(ProjectFiles.Identity)" Targets =" GetTargetPath" >
38
+ <Output TaskParameter =" TargetOutputs" PropertyName =" ProjectOutputPath" />
39
+ </MSBuild >
40
+ <PropertyGroup >
41
+ <ProjectOutputFolder >$([System.IO.Path]::GetDirectoryName($(ProjectOutputPath)))</ProjectOutputFolder >
42
+ <ProjectOutputPath >$(ProjectOutputPath.Replace('\', '\\'))</ProjectOutputPath >
43
+ <ProjectOutputFolder >$(ProjectOutputFolder.Replace('\', '\\'))</ProjectOutputFolder >
44
+ </PropertyGroup >
45
+ <ItemGroup >
46
+ <ProjectFiles Condition =" '%(Identity)' == '%(ProjectFiles.Identity)'" >
47
+ <LaunchItem >$(
48
+ LaunchTemlate
49
+ .Replace("PROJECT_NAME", %(Filename))
50
+ .Replace("OUTPUT_DLL", $(ProjectOutputPath))
51
+ .Replace("OUTPUT_FOLDER", $(ProjectOutputFolder))
52
+ )
53
+ </LaunchItem >
54
+ <TaskItem >$(
55
+ TaskTemplate
56
+ .Replace("PROJECT_NAME", %(Filename))
57
+ .Replace("PROJECT_FILE", $([System.String]::Copy('%(FullPath)').Replace('\', '\\')))
58
+ )
59
+ </TaskItem >
60
+ </ProjectFiles >
61
+ </ItemGroup >
62
+ </Target >
63
+ <Target Name =" Build" DependsOnTargets =" SetItemsMetadata" Inputs =" @(ProjectFiles)" Outputs =" $(LaunchOutput);$(TasksOutput)" >
64
+ <PropertyGroup >
65
+ <LaunchContent >
66
+ {
67
+ "version": "0.2.0",
68
+ "configurations": [
69
+ @(ProjectFiles->'%(LaunchItem)', '')
70
+ {
71
+ "name": "Attach",
72
+ "type": "coreclr",
73
+ "request": "attach"
74
+ }
75
+ ]
76
+ }
77
+ </LaunchContent >
78
+ <TasksContent >
79
+ {
80
+ "version": "2.0.0",
81
+ "tasks": [
82
+ @(ProjectFiles->'%(TaskItem)', '')
83
+ ]
84
+ }
85
+ </TasksContent >
86
+ </PropertyGroup >
87
+
88
+ <WriteLinesToFile File =" $(LaunchOutput)" Lines =" $(LaunchContent)" Overwrite =" true" />
89
+ <WriteLinesToFile File =" $(TasksOutput)" Lines =" $(TasksContent)" Overwrite =" true" />
90
+ </Target >
91
+ </Project >
0 commit comments