The C# Project is targeting ".NetFramework, Version=v4.5,Profile=Unity Full v3.5", which is not instaled on this machine

Viewed 6223

I tried to open a script in VS2015 from Unity 5.6. For some reasons, this popup shows up and I click the first option and change the target to .Net Framework 4.5.2 and everything builds and works as expected. However, every time I made changes in the Unity editor and switched back to Visual Studio, this dialog pops up again.

enter image description here

When I looked into the csproj files, I can see that, after I made changes in the Unity editor, I see this:

<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Unity Full v3.5</TargetFrameworkProfile>

Then after I selected "Change the target to .NET Framework 4.5.2" I see this:

<TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>

It seems that the Unity editor is configured to change the .Net Framework to 4.5. I tried to install .Net Framework 4.5 but it is already installed.

Is there any way I can either use .Net 4.5 in Visual Studio or change the target framework in Unity such that this dialog won't pop up again?

2 Answers

Before you do anything complicated, try this:

  1. Open Edit>Project Setting>Player
  2. Click Other Setting, go to Configuration, if the scripting runtime version is .NET 3.5, change it to .NET 4.x.

This not only fixed the warning, it also got back VS intellisense and the MathNet.Numerics can now be installed properly.

If this does not work, then try this link project-target-framework-not-installed.

Related