Skip to content

Commit

Permalink
Merge pull request #308 from ViktorHofer/XUnitDowngradeToNet462
Browse files Browse the repository at this point in the history
Downgrade xunit.runner.vs to net462
  • Loading branch information
clairernovotny committed May 5, 2022
2 parents 060bbca + 93a0178 commit c8e7163
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -6,17 +6,17 @@ To open an issue for this project, please visit the [core xUnit.net project issu

## Debugging

Debugging the VS Adapter is tricky. There are two ways to do it depending on whether you want to do it under `net472` or `netcoreapp3.1`. In all cases, you'll currently need to build your own test adapter NuGet package using `build.ps1`, `build.ps1 Packages` first to ensure you have local symbols. The symbols are not in the public package. It's helpful to add it to a local `\packages` directory and then use an entry like `<add key="Local Packages" value=".\packages" />` in your `NuGet.config` file to point to it. Don't forget to eventually delete it from your global profile `.nuget\packages\xunit...` when you're done.
Debugging the VS Adapter is tricky. There are two ways to do it depending on whether you want to do it under `net462` or `netcoreapp3.1`. In all cases, you'll currently need to build your own test adapter NuGet package using `build.ps1`, `build.ps1 Packages` first to ensure you have local symbols. The symbols are not in the public package. It's helpful to add it to a local `\packages` directory and then use an entry like `<add key="Local Packages" value=".\packages" />` in your `NuGet.config` file to point to it. Don't forget to eventually delete it from your global profile `.nuget\packages\xunit...` when you're done.

### `net472`
### `net462`
Easiest thing to do is add a `launchSettings.json` file that adds the `vstest.console.exe` as a startup project and point it to an xunit dll. Something like the following (use `/listtests` if you just want to debug the discovery portion):

```json
{
"profiles": {
"vstest console": {
"executablePath": "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Common7\\IDE\\CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe",
"commandLineArgs": ".\\bin\\Debug\\net472\\Tests.System.Reactive.dll /TestAdapterPath:.\\bin\\Debug\\net472 /listtests",
"commandLineArgs": ".\\bin\\Debug\\net462\\Tests.System.Reactive.dll /TestAdapterPath:.\\bin\\Debug\\net462 /listtests",
"workingDirectory": "C:\\dev\\RxNET\\Rx.NET\\Source\\Tests.System.Reactive\\"
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/xunit.runner.visualstudio/Constants.cs
Expand Up @@ -2,7 +2,7 @@
{
public static class Constants
{
#if NET472
#if NETFRAMEWORK
public const string ExecutorUri = "executor://xunit/VsTestRunner2/net";
#elif WINDOWS_UAP
public const string ExecutorUri = "executor://xunit/VsTestRunner2/uap";
Expand Down
16 changes: 8 additions & 8 deletions src/xunit.runner.visualstudio/xunit.runner.visualstudio.csproj
Expand Up @@ -6,7 +6,7 @@
<AssemblyTitle>xUnit.net Runner for Visual Studio ($(TargetFramework))</AssemblyTitle>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Xunit.Runner.VisualStudio</RootNamespace>
<TargetFrameworks>net472;netcoreapp3.1;uap10.0.16299</TargetFrameworks>
<TargetFrameworks>net462;netcoreapp3.1;uap10.0.16299</TargetFrameworks>
<WarningsAsErrors>true</WarningsAsErrors>
<Description>Visual Studio 2019 16.8+ Test Explorer runner for the xUnit.net framework. Capable of running xUnit.net v1.9.2 and v2.0+ tests. Supports .NET 4.7.2 or later, .NET Core 3.1 or later, and Universal Windows 10.0.16299 or later.</Description>

Expand All @@ -17,10 +17,10 @@
<TargetPlatformVersion Condition=" '$(TargetFramework)' == 'uap10.0.16299' ">10.0.19041.0</TargetPlatformVersion>
<!-- Set the PackageId explicitly as our different AssemblyNames will cause restore errors otherwise -->
<PackageId>xunit.runner.visualstudio</PackageId>
<XunitVersion>2.4.2-pre.12</XunitVersion>
<XunitVersion>2.4.2-pre.22</XunitVersion>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net472' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
<AssemblyName>xunit.runner.visualstudio.testadapter</AssemblyName>
<DefineConstants>$(DefineConstants);NETFRAMEWORK</DefineConstants>
</PropertyGroup>
Expand All @@ -42,18 +42,18 @@

<ItemGroup Label="Package">
<None Include="build\xunit.runner.visualstudio.desktop.props"
PackagePath="build\net472\xunit.runner.visualstudio.props"
PackagePath="build\net462\xunit.runner.visualstudio.props"
Pack="true" />
<None Include="$(NuGetPackageRoot)xunit.runner.reporters\$(XunitVersion)\lib\net452\*.dll"
PackagePath="build\net472"
PackagePath="build\net462"
Pack="true"
Visible="false" />
<None Include="$(NuGetPackageRoot)xunit.runner.utility\$(XunitVersion)\lib\net452\*.dll"
PackagePath="build\net472"
PackagePath="build\net462"
Pack="true"
Visible="false" />
<None Include="$(NuGetPackageRoot)xunit.abstractions\2.0.3\lib\netstandard1.0\*.dll"
PackagePath="build\net472"
PackagePath="build\net462"
Pack="true"
Visible="false" />

Expand Down Expand Up @@ -81,7 +81,7 @@
Pack="true" />

<None Include="build\_._"
PackagePath="lib\net472"
PackagePath="lib\net462"
Pack="true" />
<None Include="build\_._"
PackagePath="lib\netcoreapp3.1"
Expand Down
2 changes: 1 addition & 1 deletion test/test.harness.uwp/test.harness.uwp.csproj
Expand Up @@ -111,7 +111,7 @@
<!-- I don't know where these are coming from, but older 4.0 versions are being included and causing downgrades -->
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="System.ComponentModel.Primitives" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.4.2-pre.12" />
<PackageReference Include="xunit" Version="2.4.2-pre.22" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
Expand Down
4 changes: 2 additions & 2 deletions test/test.harness/test.harness.csproj
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.2-pre.12" />
<PackageReference Include="xunit" Version="2.4.2-pre.22" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions test/test.testcasefilter/test.testcasefilter.csproj
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net6.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="xunit" Version="2.4.2-pre.12" />
<PackageReference Include="xunit" Version="2.4.2-pre.22" />
</ItemGroup>

</Project>
@@ -1,17 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFramework>net462</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NSubstitute" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.4.2-pre.12" />
<PackageReference Include="xunit.runner.reporters" Version="2.4.2-pre.12" />
<PackageReference Include="xunit" Version="2.4.2-pre.22" />
<PackageReference Include="xunit.runner.reporters" Version="2.4.2-pre.22" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net472' ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="16.10.0" />
</ItemGroup>

Expand Down

0 comments on commit c8e7163

Please sign in to comment.