2

I've just downloaded Unity 2020.1.0f1 and included Visual Studio Community 2019 in the options. When I open C# files within Unity, each file I open loads on a new instance of VS2019 (instead of loading in another tab of the same instance), and shows the window below:

enter image description here

I went to Visual Studio Installer and made sure to install not only Developer Tools 4.7.1, but all existent versions (sorry for the image not in english but it's understandable):

enter image description here

The error keeps appearing everytime I open a C# file. How can I fix it?

Daniel
  • 7,357
  • 7
  • 32
  • 84

3 Answers3

7

You can install this targeting frameworks using the visual studio installer.

Visual Studio Installer -> Modify -> Individual Components -> Select the needed .NET Framework targeting pack versions

install components

Reference: http://dahlindevelopment.com/blog/september-2018/the-web-project-is-targeting-netframework,-version/

Refu
  • 131
  • 3
  • 6
2

I've just solved! I'll show the steps I took.


1 First, in VS2019, right click on the Project and click in Manage NuGet Packages:

enter image description here

2 Click in Browse and search for NETFramework. Look for the version that is right for you. In my case, it was this one (Microsoft.NETFramework.ReferenceAssemblies.net471):

enter image description here

3 Reload the project. In my case, the boring window stopped appearing and the files are opening in new tabs of the same VS2019 instance, instead of opening a new instance of VS2019 for each file.

Daniel
  • 7,357
  • 7
  • 32
  • 84
0

Visual Studio moved to Package Manager in 2020.1

Whitebrim
  • 396
  • 2
  • 9
  • Well, I didn't know that, but anyway, does it mean that Visual Studio Installer installs the developer tools in a random or useless place? – Daniel Aug 06 '20 at 20:33
  • I had problems like this when VS recognised new files as "additional files", but not part of "Assembly-CSharp", but restarting Unity fixed problems. My Unity 2020.1 hasn't got this kind of problems. – Whitebrim Aug 06 '20 at 20:38