Pavlenty Cox
Pavlenty Cox

Reputation: 21

Can't use .NET Core 5.0 application with Visual Studio Community 2019 Version 16.7.5

A week ago I wanted to use .NET Core 5.0. I have installed it on my PC:

enter image description here

I used dotnet commands to create some applications. It worked well. I can even launch every application I have created with .NET Core 5.0. Problems start when I create .NET Core Application with Visual Studio.

enter image description here

The solution explorer is full of warning signs:

enter image description here

ConsoleApp1.csproj file shows me that I use .NET Core 5.0 version as it should be:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

</Project>

I didn't change the applications yet. Program.cs:

using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

I decided that I should choose the Target Framework for my application. I went to the project settings and saw that my taget framework wasn't selected. I wanted to choose one but there is only .NET Framework target frameworks:

enter image description here

I tried to watch answers on the enternet. That is why I checked Use previews of the .NET Core SDK (requires restart) on:

enter image description here

It still doesn't work. It doesn't work with old or new projects. Maybe there is no chance to Debug .NET Core 5.0 with Visual Studio now?

Upvotes: 0

Views: 2849

Answers (1)

Pavlenty Cox
Pavlenty Cox

Reputation: 21

To use .NET Core 5.0 you should download the preview version of the visual studio separately (from here: https://visualstudio.microsoft.com/vs/preview/). If you have already installed .NET Core 5.0 SDK and don't know how to switch back version of the .NET Core in your project to an earlier one, then write netcoreapp3.1 (maybe another version) instead of net5.0 in your .csproj file. For example my ConsoleApp1.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp3.1</TargetFramework>
  </PropertyGroup>

</Project>

Thanks to @Ian Kemp

Upvotes: 1

Related Questions