Skip to content

Commit 3949e48

Browse files
unknownfreddyrios
unknown
authored andcommitted
Fixed unit tests netstandard compatibility
The problem was that .net framework project (UnitTests) needs to use the PackageReference style when depending on the .net standard 2 project (CA_DataUploaderLib). More info at dotnet/standard#481.
1 parent 807e2f1 commit 3949e48

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

UnitTests/UnitTests.csproj

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
43
<PropertyGroup>
54
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
65
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -20,6 +19,8 @@
2019
<NuGetPackageImportStamp>
2120
</NuGetPackageImportStamp>
2221
<TargetFrameworkProfile />
22+
<!-- needed for unit tests projects as mentioned here https://github.com/dotnet/standard/issues/481 / not the extra auto binding redirects is on by default though -->
23+
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
2324
</PropertyGroup>
2425
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2526
<DebugSymbols>true</DebugSymbols>
@@ -39,17 +40,11 @@
3940
<WarningLevel>4</WarningLevel>
4041
</PropertyGroup>
4142
<ItemGroup>
42-
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
43-
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
44-
</Reference>
45-
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
46-
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
47-
</Reference>
43+
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
44+
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
45+
<PackageReference Include="System.IO.Ports" Version="4.7.0" />
4846
<Reference Include="System" />
4947
<Reference Include="System.Core" />
50-
<Reference Include="System.IO.Ports, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
51-
<HintPath>..\packages\System.IO.Ports.4.7.0\lib\net461\System.IO.Ports.dll</HintPath>
52-
</Reference>
5348
</ItemGroup>
5449
<ItemGroup>
5550
<Compile Include="CALogTests.cs" />
@@ -72,16 +67,6 @@
7267
</ItemGroup>
7368
<ItemGroup>
7469
<None Include="app.config" />
75-
<None Include="packages.config" />
7670
</ItemGroup>
77-
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
7871
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
79-
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
80-
<PropertyGroup>
81-
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
82-
</PropertyGroup>
83-
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
84-
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
85-
</Target>
86-
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
8772
</Project>

UnitTests/app.config

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<runtime>
4-
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5-
<dependentAssembly>
6-
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
7-
<bindingRedirect oldVersion="0.0.0.0-4.1.1.1" newVersion="4.1.1.1" />
8-
</dependentAssembly>
9-
</assemblyBinding>
10-
</runtime>
113
</configuration>

UnitTests/packages.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)