简体   繁体   中英

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

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.

在此输入图像描述

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?

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM