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

Allow using VS to run host tests when libraries use different config #91873

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions docs/workflow/testing/host/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ The `category!=failing` is to respect the [filtering traits](../libraries/filter
### Visual Studio

The [Microsoft.DotNet.CoreSetup.sln](/src/installer/Microsoft.DotNet.CoreSetup.sln) can be used to run and debug host tests through Visual Studio. When using the solution, the product should have already been [built](#building-tests) and the [test context](#test-context) set up.
If you built the runtime or libraries with a different configuration from the host, you have to specify this when starting visual studio:

```console
build.cmd -vs Microsoft.DotNet.CoreSetup -rc Release -lc Release
```

### Preserving test artifacts

Expand Down
6 changes: 6 additions & 0 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ if ($vs) {
$env:RUNTIMECONFIGURATION=$runtimeConfiguration
}

if ($librariesConfiguration)
{
# Respect the RuntimeConfiguration variable for building inside VS with different libraries configurations
$env:LIBRARIESCONFIGURATION=$librariesConfiguration
}

# Launch Visual Studio with the locally defined environment variables
."$vs"

Expand Down
2 changes: 2 additions & 0 deletions eng/generators.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<PropertyGroup>
<EnableLibraryImportGenerator Condition="'$(EnableLibraryImportGenerator)' == '' and
'$(MSBuildProjectName)' == 'System.Private.CoreLib'">true</EnableLibraryImportGenerator>

<ShouldUnsetParentConfigurationAndPlatform>false</ShouldUnsetParentConfigurationAndPlatform>
</PropertyGroup>

<ItemGroup>
Expand Down