Skip to content

Commit c66fa99

Browse files
authored
Add .runsettings file to be able to run and debug tests on vscode in codespace with prebuilt (#61684)
1 parent 8076522 commit c66fa99

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

.devcontainer/devcontainer.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@
1212

1313
"settings": {
1414
// Loading projects on demand is better for larger codebases
15-
"omnisharp.enableMsBuildLoadProjectsOnDemand": true
15+
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
16+
"omnisharp.enableRoslynAnalyzers": true,
17+
"omnisharp.enableEditorConfigSupport": true,
18+
"omnisharp.enableAsyncCompletion": true,
19+
"omnisharp.testRunSettings": "${containerWorkspaceFolder}/artifacts/obj/vscode/.runsettings"
1620
},
1721

1822
// Add the IDs of extensions you want installed when the container is created.

.devcontainer/scripts/onCreateCommand.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -e
44

55
# prebuild the repo, so it is ready for development
66
./build.sh libs+clr -rc Release
7+
# restore libs tests so that the project is ready to be loaded by OmniSharp
8+
./build.sh libs.tests -restore
79

810
# save the commit hash of the currently built assemblies, so developers know which version was built
911
git rev-parse HEAD > ./artifacts/prebuild.sha

eng/testing/runsettings.targets

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<CreateIntermediateRunSettingsFile Condition="'$(CreateIntermediateRunSettingsFile)' == ''">false</CreateIntermediateRunSettingsFile>
88
<RunSettingsOutputFilePath Condition="'$(CreateIntermediateRunSettingsFile)' == 'true'">$(RunSettingsIntermediateOutputFilePath)</RunSettingsOutputFilePath>
99
<RunSettingsOutputFilePath Condition="'$(CreateIntermediateRunSettingsFile)' != 'true'">$(RunSettingsAppOutputFilePath)</RunSettingsOutputFilePath>
10+
<VsCodeRunSettingsOutputFilePath>$(ArtifactsObjDir)vscode/.runsettings</VsCodeRunSettingsOutputFilePath>
1011

1112
<!-- Set RunSettingsFilePath property which is read by VSTest. -->
1213
<RunSettingsFilePath Condition="Exists('$(RunSettingsAppOutputFilePath)')">$(RunSettingsAppOutputFilePath)</RunSettingsFilePath>
@@ -46,6 +47,12 @@
4647
WriteOnlyWhenDifferent="true"
4748
Overwrite="true" />
4849

50+
<WriteLinesToFile File="$(VsCodeRunSettingsOutputFilePath)"
51+
Lines="$(RunSettingsFileContent)"
52+
WriteOnlyWhenDifferent="true"
53+
Overwrite="true"
54+
Condition="'$(CreateVsCodeRunSettingsFile)' == 'true'" />
55+
4956
<!-- Set RunSettingsFilePath property which is read by VSTest. -->
5057
<PropertyGroup>
5158
<RunSettingsFilePath>$(RunSettingsOutputFilePath)</RunSettingsFilePath>

src/libraries/pretest.proj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<!-- Create an intermediate runsettings file to enable VSTest discovery. -->
66
<EnableRunSettingsSupport>true</EnableRunSettingsSupport>
77
<CreateIntermediateRunSettingsFile>true</CreateIntermediateRunSettingsFile>
8+
<CreateVsCodeRunSettingsFile>true</CreateVsCodeRunSettingsFile>
89
</PropertyGroup>
910

1011
<PropertyGroup>

0 commit comments

Comments
 (0)