I am trying to deploy stateless micro service application into service fabric but I get this error as soon as I start the deployment.

Project is targeting runtime 'win7-x64' but did not resolve any runtime-specific packages for the 'Microsoft.NETCore.App' package. This runtime may not be supported by .NET Core.

How to fix this ?

2

There are 2 answers

0
Mr Qian On

If you create your stateless micro service application on VS2019, you should note that Net Core <=3.0 is not supported by Stateless project.

So you should target your project framework to at least Net Core 3.1.

Right-click on your project Properties-->Application-->change target framework version to net core 3.1.

enter image description here

If I target project into net core 2.2, the error will happen.

enter image description here

Note that, you should make sure that your target framework version of the pubxml file is the same of your project target framework version.

enter image description here

0
brianwentz On

If you're unable to upgrade to .NET Core 3.1, you can suppress this error by adding this inside a <PropertyGroup> in your project file:

<EnsureNETCoreAppRuntime>false</EnsureNETCoreAppRuntime> 

The error is a design-time error and won't cause a runtime failure.