Reputation: 503
I want to write unit test cases for a project which was built using .net core 2.1
.
Unit test project using .net framework 4.6.1
.
I am facing below issue while adding .net core app reference
in Unit test project
.
Project '..\MSNetCoreApp.csproj' targets 'netcoreapp2.1'.It cannot be referenced by a project that targets '.NETFramework,Version=v4.6.1'. MSUnitTests
Upvotes: 1
Views: 230
Reputation: 26727
It cannot be done.
Your MSNetCoreApp
is compiled to run on .NET Core Framework, while your test project needs to run on full .NET Framework. They are not compatible.
You need to create new test project targeting netcoreapp2.1
or to convert existing one.
Only class libraries targeting netstandard
can be referenced by both netcore
and netframework
assemblies.
Upvotes: 1