The reference assemblies for framework ".NETFramework,Version=v4.5" were not found.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By thedudelebowski

I get the error below when trying to build a C# project in Godot 3.1. I was previously using Godot 3.0.6 for many months with C# projects with no issues at all, then I started using Godot 3.1. Now I can’t even open previously ok C# projects in Godot 3.0.6 (it just crashes).

I’m having no issues with projects that just use GDscript in 3.0.6 or 3.1, all working fine.

Does anybody know what is going on?

Project "Test C Sharp 3.1.sln" (Build target(s)):
	Message: Building solution configuration "Tools|Any CPU".
	Project "Test C Sharp 3.1.csproj" (default targets):
		C:\Program Files\Mono\lib\mono\msbuild\15.0\bin\Microsoft.Common.CurrentVersion.targets(1191,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [C:\Godot\Test C Sharp 3.1\Test C Sharp 3.1.csproj]
		MakeDir: Creating directory ".mono\temp\obj\Tools\".
	Done building project "Test C Sharp 3.1.csproj" -- FAILED.
Done building project "Test C Sharp 3.1.sln" -- FAILED.

Hey I hope this doesn’t sound snarky, but have you tried reinstalling .net 4.5 sdk yet? I have had issues with mono on Linux and it was usually caused by me messing with a new mono install. That’d be my first start in troubleshooting.

Secondly, in project settings there should be an option for compiler to use, make sure it’s MSBUILD. I’m not near my computer now so I cant tell you where this is exactly located in Godot.

dhav211 | 2019-09-14 04:31

Thanks for the advice. I have tried reinstalling .net sdk 4.5.1 (couldn’t find plain 4.5 on the MS website), with no effect. I also uninstalled Mono 6.0 and rolled back to version 5.12. Now Godot 3.0.6 is working again and can compile my existing C# projects, which is a good start. But I want to be using Godot 3.1.

Edited: I found that option. It is set to MS Build (Mono). This works fine in Godot 3.0.6 but not 3.1. Changing to MS Build (VS Build Tools) just crashes Godot on build.

Edited again to clarify: On Godot 3.0.6, the project compiles with this set to either MS Build (Mono) or MS Build (VS Build Tools).

thedudelebowski | 2019-09-14 20:00

:bust_in_silhouette: Reply From: thedudelebowski

OK, I have got it working :slight_smile: I changed the target framework in the .csproj file to 4.5.1:

<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>

I don’t know why this is required for Godot 3.1, but 3.0.6 works fine with v4.5. Anyway, it compiles and runs fine, so all good.

:bust_in_silhouette: Reply From: ondesic

Somehow 4.5 is not on my machine. I have 4.8 framework. I found 4.5 and tried to install it. However it tells me I can’t because I have a higher version already.

Here is what I did. I downloaded 4.5.1 found here:

It installs fine.

Next, I open the “.csproj” file in my project. I change the line

 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

to

<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>

save it and run the project again. IT WORKS!!!
Hopefully Godot changes the needed .NET framework to 4.8 soon

UPDATE:
Godot version 3.2 now supports v4.7.2 Here is a link:

in the code above, replace v4.5 or v4.5.1 with v4.7.2

OMG you save my life. It works!! Thank you very Much, because we will use this for our project,Thank you so much…

Delirious | 2019-11-08 15:07