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

Support executing the test host with a specific --fx-version and define a default #205

Merged
merged 1 commit into from
Feb 6, 2025
Merged
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
10 changes: 9 additions & 1 deletion src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<PropertyGroup>
<TestRoot Condition="'$(TestRoot)' == ''">$(ArtifactsObjDir)generatedtests/</TestRoot>
<TestSdkVersion Condition="'$(TestSdkVersion)' == ''">$(NETCoreSdkVersion)</TestSdkVersion>
<!-- Allow executing the test host with a specific shared framework version (i.e. 10.0.0-ci).
This is necessary as i.e. in the VMR, the live built shared framework has a `-dev` or `-ci`
suffix which could be determined as "lower" than the toolset SDK's shared framework that the repo
builds with. As an example `10.0.0-ci` and `10.0.0-dev` are considered lower than `10.0.0-preview.1`
by the host (in accordance with semver2). -->
<TestFxVersionOverride Condition="'$(UseFxVersionOverride)' == 'true' and '$(TestFxVersionOverride)' == ''">$(BundledNETCoreAppPackageVersion)</TestFxVersionOverride>
<TestBinlogDir Condition="'$(TestBinlogDir)' == ''">$(ArtifactsTestResultsDir)</TestBinlogDir>
</PropertyGroup>

Expand Down Expand Up @@ -53,13 +59,15 @@
<TestArgs>$(TestArgs) $(AdditionalTestArgs)</TestArgs>

<_MSBuildSdksDir>$(DotNetRoot)sdk/$(TestSdkVersion)/Sdks</_MSBuildSdksDir>

<TestFxVersionOverrideCLI Condition="'$(TestFxVersionOverride)' != ''">--fx-version $(TestFxVersionOverride) </TestFxVersionOverrideCLI>
</PropertyGroup>

<ItemGroup>
<_TestEnvVars Include="MSBuildSDKsPath=$(_MSBuildSdksDir)" />
</ItemGroup>

<Exec Command='"$(DotNetTool)" "$(TargetPath)" $(TestArgs)'
<Exec Command='"$(DotNetTool)" exec $(TestFxVersionOverrideCLI)"$(TargetPath)" $(TestArgs)'
EnvironmentVariables="@(_TestEnvVars)" />
</Target>

Expand Down