I'm starting out with Test-Driven Development with Visual Studio 2017 Enterprise, but can't - however hard I've tried - make it work. I've tried trawling everywhere on the WWW to search for a solution, to no avail. So I hope that someone here will be able to help. The issue goes as follows:
I have created an ASP.NET Core web application, and a separate Test project; I'm using NUnit as the test framework (I first used xUnit but for some reason the tests disappeared and would not run). Anyway, when I try to reference my ASP.NET Core Web app from the test project, the following error shows up:
Project '..\MyProject\MyProject.csproj' targets 'netcoreapp2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.7'. UnitTestProject1
Does anyone have a clue about what can be wrong and how it can be fixed? Any help will be greatly appreciated.
Best regards.
EDIT
I am elaborating a little on the issue here. I try to illustrate it below. I have attached 3 images to show what I mean.
First, when I want to create a test project in Visual Studio, I go to the "Test" templates - and there I only see the templates shown in fig. 1 - there I have the possibility for selecting between different .NET versions as shown in the dropdown. Regardless of which one I selected I received the error mentioned in my earlier post.
Then, I tried using the .NET Core templates where I found 2 types of test projects: MSTest and xUnit tests (see fig. 2). MSTest is not usable in my case as it's a bit too limited for this exact application. Therefore, I tried using the xUnit test project. However, when I do that, the system complains about all sorts of libraries missing, and when looking in the "Dependencies" section in the solution explorer, all libraries are shown with a yellow "Warning" triangle on them (see fig. 3), and nothing compiles at all.
So I'm a bit stuck. Any ideas?