3

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?

3
  • 1
    The problem is that visual studio doesnt know what Profile=Unity Full v3.5 is. Commented Jun 4, 2017 at 20:04
  • Hmm is there way for VS to know that Commented Jun 4, 2017 at 20:17
  • The link below helped me: forum.unity.com/threads/… Commented Mar 18, 2019 at 13:04

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

In the Unity roadmap is stated that support for .net 4.6 will be added arround july 2017. The beta is out allready.

Scripting Runtime Upgrade (Preview)

Upgrade Mono and IL2CPP .NET runtimes to support the latest .NET functionality and APIs. This includes access to C# 6 and the .NET 4.6.x class library profile.

Currently Unity is only compatible with .net 3.5 but here is an workaround which may help.


If you have any of the .NET Framework v4.6 series allready installed you only need to install the Visual Studio 2015 Tools for Unity to be able to use the project without conversions.

1 Comment

I already had the "Visual Studio 2015 Tools for Unity" installed. Still the same problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.