trouble trusting https certificates for .net 6 - asp.net

I'm trying to set up a web app project in visual studio 2022 and when I run it asks me to trust SSL and it says there was an error trusting and always start in untrusted mode in the browser.
I tried running
dotnet dev-certs https --clean
dotnet dev-certs https --trust
but I get an output saying there was an error trusting https certificates.
These are the details if I run info if it matters:
dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.400
Commit: 7771abd614
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19043
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.400\
global.json file:
Not found
Host:
Version: 6.0.8
Architecture: x64
Commit: 55fb7ef977
.NET SDKs installed:
3.1.120 [C:\Program Files\dotnet\sdk]
6.0.400 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

I was having the same problem. After running the codes you specified. I restarted my computer and problem solved.
Also, when you run the project again, the option to trust SSL certificate should appear.
You must select yes for both options.
enter image description here
enter image description here

For problems getting an untrusted certificate warning, you can try using a PowerShell script.
https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/installation/warnings-untrusted-certificate#method-1-use-a-powershell-script
Another way is to configure the computer to trust the IIS Express certificate
https://learn.microsoft.com/en-us/troubleshoot/developer/visualstudio/installation/warnings-untrusted-certificate#method-2-configure-computers-to-trust-the-iis-express-certificate

I tried all the suggestions written in this post and nothing worked. Re-installed windows and now I got no issues with certificates.
It ain't stupid if it works?

Related

What is the meaning of 'Host (useful for support)' in output of 'dotnet --info'

Output from dotnet --info:
.NET Core SDK (reflecting any global.json):
Version: 3.1.416
Commit: 8d3765c609
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19044
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.416\
Host (useful for support):
Version: 5.0.13
Commit: b3afe99225
.NET SDKs installed:
3.1.416 [C:\Program Files\dotnet\sdk]
5.0.404 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.22 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
What does 'Host (useful for support) Version 5.0.13' mean here?
I have a global.json to specify that I want to use 3.1.416:
global.json:
{
"sdk": {
"version": "3.1.416",
"rollForward": "disable"
}
}
But this 'Host (useful for support)' seems to indicate that I am using 5.0.13 after all.
So, you already knew that on a single machine multiple .NET Core SDK can be installed, like 3.1 and 5.0 on yours.
They both install to a common place C:\Program Files\dotnet\sdk, but there is a single dotnet.exe executable, which usually comes from the newest .NET Core SDK installation, which is the "Host" in your context.
When you set the desired SDK version in global.json, the 5.0 Host is smart enough to redirect all actual commands (like dotnet build) to utilize the 3.1 SDK bits.

Error when trying to open Power BI (Analysis Services) ADOMD.NET connection using .NET Core 3.1

While using the Microsoft.AnalysisServices.AdomdClient.NetCore.retail.amd64 library version 19.26.1.2 (also tried older version) and trying to connect to Power BI dataset using ADOMD.NET connection from .NET Core 3.1 (also tried 3.0) Azure Function app, on the line:
adomdConnection.Open();
I get this error message:
System.Private.CoreLib: Exception while executing function: Function1.
Microsoft.AnalysisServices.AdomdClient: This feature is supported for
a .NET Core client only on Windows systems and requires that the .NET
Core Desktop framework is installed.
However, I am running Windows 10 (and Visual Studio 2019) and I'm pretty sure I do have installed the mentioned .NET Core runtime:
dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.28 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
I've tried searching for this error message but I found nothing.
How can this issue be resolved?

Error when trying to install dotnet tools

I'm trying to install Microsoft.dotnet-interactive tool but have this issue,
Also tried with different tools same issue
I tried the following commands
dotnet tool install --global Microsoft.dotnet-interactive
dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.110520
dotnet tool install --global Microsoft.dotnet-interactive --version 1.0.115407
dotnet tool install --global dotnet-interactive
dotnet tool install --global dotnet-interactive --version 1.0.115407
Failed to install tool package 'microsoft.dotnet-interactive': Could not find a part of the path 'C:\Users\*\.dotnet\tools\.store\.stage\mfbifbk3.jlo\microsoft.dotnet-interactive'.
Tool 'microsoft.dotnet-interactive' failed to install. This failure may have been caused by:
You are attempting to install a preview release and did not use the --version option to specify the version.
A package by this name was found, but it was not a .NET Core tool.
The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
2.1.604 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
Any idea?
Thank you
For what it's worth, you are not quite running the latest of .NET Core SDK version (or runtime): if you are able on your particular machine, install the latest version (depending on your version of Visual Studio). This might cure your problem.
https://dotnet.microsoft.com/download
My configuration via dotnet --info, as the tools install correctly on Visual Studio 2019. If you have updated your .NET Core then the other major difference is the Windows version; not sure that would be significant:
.NET Core SDK (reflecting any global.json):
Version: 3.1.201
Commit: b1768b4ae7
Runtime Environment:
OS Name: Windows
OS Version: 10.0.19041
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.1.201\
Host (useful for support):
Version: 3.1.3
Commit: 4a9f85e9f8
.NET Core SDKs installed:
2.1.511 [C:\Program Files\dotnet\sdk]
2.1.513 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.201 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

.net standard compatibility

According to this page, .NET Core 2.1.15 is compatible with .NET standard 2.0. We have an application that had projects with the above versions and it worked, but when we loaded it again recently, we received the following error:
The current .NET SDK does not support targeting .NET Standard 2.0. Either target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.0.
Our app MUST use SDK ver 2.1.803 (defined in global.json) and .net core 2.1.15 (Also specified in appsettings).
Here are my installed .net versions:
C:\Windows\system32>dotnet --info .NET Core SDK (reflecting any
global.json): Version: 2.2.109 Commit: 586f23c400
Runtime Environment: OS Name: Windows OS Version: 10.0.17134
OS Platform: Windows RID: win10-x64 Base Path: C:\Program
Files\dotnet\sdk\2.2.109\
Host (useful for support): Version: 2.2.7 Commit: b1e29ae826
.NET Core SDKs installed:
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.511 [C:\Program Files\dotnet\sdk]
2.1.803 [C:\Program Files\dotnet\sdk]
2.2.109 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.9
[C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.15 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.15 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program
Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App
2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.9 [C:\Program
Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App
2.1.15 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.7 [C:\Program
Files\dotnet\shared\Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
We tried the following:
Uninstalled all .net core and sdk versions that were not 2.1.15 and 2.1.803 respectively,
Updated VS 2017 to the latest version
Downgraded to .NET Standard 1.6, but we had a lot of features that were not available to this version
Added .NET Standard nuget package back and updated all .NET Standard projects to use it, but received a similar message: SDK incompatibility.
So my questions are:
How do I know what .NET standard version is installed on my machine?
Did anyone experience this issue before?
Thanks
Alex
VS 2019 resolved the issue. It is the only IDE to work with .net Core 2.1.15 and SDK 2.1.803

After updated Visual Studio 2019 to 16.4.0 I can't run tests with target framework 2.2

I have updated Visual studio 2019 to version 16.4.0. This version includes .NET Core SDK 3.1.100.
After that, I have tried to run some Unit Tests that I have on a project with Target Framework 2.2 but it's not being able to do so.
It gives the following error:
Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: Testhost process exited with error: It was not possible to find any compatible framework version
The framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
- The following frameworks were found:
3.1.0 at [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
You can resolve the problem by installing the specified framework and/or SDK.
If I go to the aforementioned path I only found a 3.1.0 folder.
If I list the installed SDKS I get this:
dotnet --list-sdks
2.1.602 [C:\Program Files\dotnet\sdk]
2.1.700 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.1.802 [C:\Program Files\dotnet\sdk]
2.2.100 [C:\Program Files\dotnet\sdk]
2.2.202 [C:\Program Files\dotnet\sdk]
2.2.207 [C:\Program Files\dotnet\sdk]
2.2.300 [C:\Program Files\dotnet\sdk]
2.2.301 [C:\Program Files\dotnet\sdk]
2.2.401 [C:\Program Files\dotnet\sdk]
2.2.402 [C:\Program Files\dotnet\sdk]
3.1.100 [C:\Program Files\dotnet\sdk]
If I ask for the installed runtimes I get this:
dotnet --list-runtimes
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
So, I see Microsoft.AspNetCore.App', version '2.2.0' installed on the listed runtimes.
On the other hand, If I do: 'dotnet test' on the Unit Test project from within the Package Manager Console the tests are being run.
I also have Visual Studio Code installed and without any change, I can even Debug those Tests.
So, I'm a little bit lost here and I have tried for instance to manually copy the 2.2.0 Folder from C:\Program Files\dotnet\shared\ but after that, I got other errors while trying to run the tests.
Could anyone help me or point me in the right direction.
After looking at the solution from #coloradoeos I discovered a different way to solve this without needing to install an x86 version.
Simply go to Test > Process architecture for anyCPU projects > x64
Tests should run normally after selecting x64.
I'll refer you to this link.
The root cause appeared to be the lack of an x86 .NET Core 2.2 SDK instance under the following directory "C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App".
I only had a 3.1 version present, so I specifically downloaded an x86 version of the 2.2 SDK and installed it. Once I did that, the testhost ran my unit tests from Visual Studio (VS) just fine. I never uninstalled the old version of the SDK, so this must be an issue with the update process for the framework/VS.
If you have the same issue in Azure build pipeline.
change the target platform from in your test project to X64.
Visual Studio was configured to run AnyCPU tests as x86, but only the x64 SDK was installed. set VS to use x64 for AnyCPU tests.
Also
Upgraded to Microsoft.NET.Test.Sdk to the latest version.
And also in my case, I had to add a specific .NET core version to build pipeline.
Find specific .NET core version Here
Try changing project framework to the ones that are found i.e 3.1 or 5.0: Right click on project -> Properties -> Application -> Target framework

Resources