Unit tests work in Resharper but not MSTests - .net-core

We recently moved to .NET Core 3.1, and then back to 2.2 until we could update some dependencies that did not work under 3.1. After this, tests in MS Test would not run due to the reason below.
[1/2/2020 1:32:44.790 PM] ---------- Discovery started ----------
Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process exited with error: It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '2.2.0' was not found.
- The following frameworks were found:
3.0.1 at [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
3.1.0 at [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
The specified framework can be found at:
- https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=2.2.0&arch=x86&rid=win10-x86
. Please check the diagnostic logs for more information.
The tests run in Resharper.
I reinstalled .NET Core 2.2.8 SDK from here but that did not help. After installation I noticed that C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App did not have a folder for 2.2.8.
How do I get the tests to run in MS Test and/or get that folder populated (and why wasn't it populated after installing that version for that matter)?

Related

ASP.NET Nuget version error when deploying to Heroku

When I deploy to Heroku, I get an error stating that my Nuget version is not up to date. When I checked my Nuget version from the command line, it was 6.2.1.2, and I don't have Microsoft.ClearScript.V8 7.2.1 installed locally. Therefore, I think the issue is that Heroku doesn't have the right Nuget version for the buildpack, but I'm not sure how to remedy this. Other buildpacks throw errors earlier on.
Full error output:
-----> Building on the Heroku-18 stack
-----> Using buildpack: https://github.com/jincod/dotnetcore-buildpack#v2.1.300
-----> ASP.NET Core app detected
Installing dotnet
publish /tmp/build_ed54e936/RoundTheCode.GoogleAuthentication/RoundTheCode.GoogleAuthentication.csproj
Microsoft (R) Build Engine version 15.7.179.6572 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
Restoring packages for /tmp/build_ed54e936/RoundTheCode.GoogleAuthentication/RoundTheCode.GoogleAuthentication.csproj...
/tmp/build_ed54e936/.heroku/dotnet/sdk/2.1.300/NuGet.targets(114,5): error NU1401: The 'Microsoft.ClearScript.V8 7.2.1' package requires NuGet client version '4.9.0' or above, but the current NuGet version is '4.7.0'. To upgrade NuGet, please go to http://docs.nuget.org/consume/installing-nuget [/tmp/build_ed54e936/RoundTheCode.GoogleAuthentication/RoundTheCode.GoogleAuthentication.csproj]
! Push rejected, failed to compile ASP.NET Core app.
! Push failed

Detected package downgrade for Boilerplate Application(.NET Core 3.1)

I'm trying to open my Boilerplate Application(.NET Core 3.1)in VSCode in Linux but below exception, keep appeared for me. Is there any difference between .NET Core for Linux and for Windows or What is the problem?
Detected package downgrade: Abp.ZeroCore from 5.7.0 to 5.1.0. Reference the package directly from the project to select a different version.
No this is not related to the OS that you run your application.
As stated in the error message there a downgrade in one of your nuget packages.
Go to your Boilerplate.csproj and try to manually set the version of Abp.ZeroCore nuget package from 5.1.0 that it is currently to 5.7.0.

Unable to find package Microsoft.NETCore.App with version (>= 3.1.0)

I have .NET Core SDK 3.1.200 installed on my local machine.
I create a Asp.Net Core app (using Visual Studio) targeting netcoreapp3.1. I test it and it works fine.
But when I commit it to CI the build fails to get the nuget package:
##[error]The nuget command failed with exit code(1) and error(NU1102: Unable to find package Microsoft.NETCore.App with version (>= 3.1.0)
- Found 81 version(s) in MyGet [ Nearest version: 3.0.0-preview8-28405-07 ]
- Found 73 version(s) in NuGet [ Nearest version: 2.2.8 ]
.NET Core 3.1 was released in December 2019 so why is the package not on nuget?
What am I missing?
Update
The CI is Azure Devops Pilelines and the agents are Windows machines that have Visual Studio 2017 installed. .Net core sdk 3.1 is not installed on the agents
Method 1:
Add the following task in your yaml
steps:
- task: UseDotNet#2
displayName: 'Use .Net Core sdk 3.1.x'
inputs:
version: 3.1.x
Method 2:
If using template editor, add Use .Net Core task and provide the version over there
Note: Make sure this should be the first task of the pipeline configured

error occurred while loading required library hostpolicy.dll

I would to like update the database but when i run : 'update-datebase' or the command : `add-migiration' in the Package Manager Console it give this error
Failed to load the dll from
[C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.7\hostpolicy.dll],
HRESULT: 0x800700C1
An error occurred while loading required library hostpolicy.dll from
[C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.2.7]
Things that have been done:
Update .Net Core to 2.2.7
Remove .Net Core 3.
Run VS(2017 & 2019) in administrator mode
Update nucket packages
Microsoft.EntityFrameworkCore v2.2.6
Microsoft.EntityFrameworkCore.Tools V 2.2.6

Which version of Microsoft.AspNet.Mvc is supported by .NETCoreApp v2.2?

I am working on a Ubuntu 18.04 environment using Visual Studio Code and .NET Core v2.2.
After including a few existing projects into a solution that I'm working on, I ran into errors when I tried to compile stating that the namespace "Microsoft.AspNet.Mvc" could not be found.
So, I added a package reference for the projects that were complaining by using the dotnet CLI:
dotnet add package Microsoft.AspNet.Mvc --version 3.0.20105.1
But now when I try to dotnet restore or dotnet msbuild the solution file, I'm getting warnings reporting that:
warning NU1701: Package 'Microsoft.AspNet.Mvc 3.0.20105.1' was
restored using '.NETFramework,Version=v4.6.1' instead of the project
target framework '.NETCoreApp,Version=v2.2'.
This package may not be fully compatible with your project.
I would like to figure out which package version of Microsoft.AspNet.Mvc I need to install in order to be compatible with .NET Core v2.2.
I realize that this is just a warning and using the .NETFramework v4.6.1 may be okay, but I have been debugging a very strange issue that is only happening on a Ubuntu environment, so I would like to determine whether package versioning is a problem.
I have tried Google searching to determine which version of MVC is compatible with .NET Core 2.2, but I have yielded any useful results.
Does anyone know the answer to this question? Or would you be able to point me in the direction of a source that can answer it?

Resources