Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate .runsettings file to be able to run and debug tests on vscode in codespace with prebuild #61684

Merged
merged 1 commit into from
Nov 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@

"settings": {
// Loading projects on demand is better for larger codebases
"omnisharp.enableMsBuildLoadProjectsOnDemand": true
"omnisharp.enableMsBuildLoadProjectsOnDemand": true,
"omnisharp.enableRoslynAnalyzers": true,
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableAsyncCompletion": true,
"omnisharp.testRunSettings": "${containerWorkspaceFolder}/artifacts/obj/vscode/.runsettings"
},

// Add the IDs of extensions you want installed when the container is created.
Expand Down
2 changes: 2 additions & 0 deletions .devcontainer/scripts/onCreateCommand.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -e

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

# save the commit hash of the currently built assemblies, so developers know which version was built
git rev-parse HEAD > ./artifacts/prebuild.sha
7 changes: 7 additions & 0 deletions eng/testing/runsettings.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<CreateIntermediateRunSettingsFile Condition="'$(CreateIntermediateRunSettingsFile)' == ''">false</CreateIntermediateRunSettingsFile>
<RunSettingsOutputFilePath Condition="'$(CreateIntermediateRunSettingsFile)' == 'true'">$(RunSettingsIntermediateOutputFilePath)</RunSettingsOutputFilePath>
<RunSettingsOutputFilePath Condition="'$(CreateIntermediateRunSettingsFile)' != 'true'">$(RunSettingsAppOutputFilePath)</RunSettingsOutputFilePath>
<VsCodeRunSettingsOutputFilePath>$(ArtifactsObjDir)vscode/.runsettings</VsCodeRunSettingsOutputFilePath>

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

<WriteLinesToFile File="$(VsCodeRunSettingsOutputFilePath)"
safern marked this conversation as resolved.
Show resolved Hide resolved
eerhardt marked this conversation as resolved.
Show resolved Hide resolved
Lines="$(RunSettingsFileContent)"
WriteOnlyWhenDifferent="true"
Overwrite="true"
Condition="'$(CreateVsCodeRunSettingsFile)' == 'true'" />

<!-- Set RunSettingsFilePath property which is read by VSTest. -->
<PropertyGroup>
<RunSettingsFilePath>$(RunSettingsOutputFilePath)</RunSettingsFilePath>
Expand Down
1 change: 1 addition & 0 deletions src/libraries/pretest.proj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<!-- Create an intermediate runsettings file to enable VSTest discovery. -->
<EnableRunSettingsSupport>true</EnableRunSettingsSupport>
<CreateIntermediateRunSettingsFile>true</CreateIntermediateRunSettingsFile>
<CreateVsCodeRunSettingsFile>true</CreateVsCodeRunSettingsFile>
</PropertyGroup>

<PropertyGroup>
Expand Down