Godot version:
Godot Engine v3.2.2.stable.mono.official
OS/device including version:
Building on Windows 10 64 bit with Visual Studio 2019 installed.
Issue description:
Each time when running the command Install-Package in Visual Studio 2019 to get packages like Newtonsoft.Json it throws the following error consistently:
Install-Package : NU1101: Unable to find package Microsoft.NETFramework.ReferenceAssemblies. No packages exist with this id in source(s): Local mono packages, Microsoft Visual Studio Offline Packages, Project Packages
And this error prevents the installation of the C# packages. I can load in dll files but unfortunately far from all C# packages have dll files available to download, many require a Install-Package command installation.
Steps to reproduce:
Create a new Godot mono project, add a C# script, build it once. Open up the .sln with Visual Studio 2019 and use the NuGet package manager to install whatever package.
This may or may not also be related to #40805 as they are both missing assemblies. It is just a guess.
Can you try with 3.2.3 RC 3?
Thanks for the response akien, I just tried it with 3.2.3 RC 3! I now get this error message in the mono console of the Godot editor when attempting to build and launch the project from the Godot editor:
error NU1101: Unable to find package Microsoft.NETFramework.ReferenceAssemblies. No packages exist with this id in source(s): Local mono packages, Microsoft Visual Studio Offline Packages, Project Packages [C:\Users\Classy\Desktop\rc3testproj\Rc 3 Testproj.sln]
Mind you this didn't happen in the Godot mono console before, only in visual studio 2019 when attempting to install packages.
Also, a new interesting thing happens when opening this newly RC3 created project with Visual Studio 2019, I got an incompatibility message stating that "The application which this project type is based on was not found. Please try this link for further information:聽http://go.microsoft.com/fwlink/?LinkID=299083&projecttype=8F3E2DF0-C35C-4265-82FC-BEA011F4A7ED"
With a then generated by visual studio upgrade log stating the same.

And visual studio 2019 displays the newly created project in the following way after the incompatibility message:

I am far from an experienced C# programmer, any help with this is appreciated!
In 3.2.2stable I could still build and launch the project just fine and that error only occurred when attempting to install packages.
The Install-Package command now returns this error in the RC3 project: Install-Package : Project 'Default' is not found.
Note that starting with 3.2.3 (including the RC3), there's an addin you can use for Visual Studio support: https://github.com/godotengine/godot-csharp-visualstudio
Maybe that's what the error is referring to? I'm not so familiar with the C# development workflow either, so I'm not sure.
In any case, it's a bit confusing so usability-wise there are likely necessary improvements.
Unfortunately in order to extend Visual Studio to add functionality for Godot projects we need to the project to have a custom project type guid the extension can handle. At the same time if there's no extension that recognizes that project type guid then Visual Studio can't open the project at all.
It's very annoying because both MonoDevelop/VSMac and Rider allow the extension to use its own logic to detect whether to handle the project or not. But it's what it is, so starting with 3.2.3 in order to open the solution with VS you will need to install the extension: https://github.com/godotengine/godot-csharp-visualstudio/releases/tag/v1.1.1 (it will be available in the marketplace soon as well)
Great, I can now open new Godot 3.2.3 RC3 projects with Visual Studio! I just can no longer build and run the new RC3 project, not from the Godot editor either. I get the following error with RC3: C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj(0,0): error NU1101: Unable to find package Microsoft.NETFramework.ReferenceAssemblies. No packages exist with this id in source(s): Local mono packages, Microsoft Visual Studio Offline Packages, Project Packages [C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.sln] So the same error I am facing with my 3.2.2 project when attempting to install C# packages.
I use a lot of NuGet packages with 3.1
The way I get it working is like this:
msbuild takes care of fetching the nuget packagesNot a fix, but maybe it can help you out for now.
@timothyparez Thank you, for 3.2.2 this works!!
I do hope that for Godot 3.2.3 this missing Microsoft.NETFramework.ReferenceAssemblies error gets resolved because otherwise, I won't be able to work with C# at all anymore as no project will build or run then! But for now, in 3.2.2 I can still build & run Godot mono games/projects and install C# packages using the aforementioned method.
I do hope that for Godot 3.2.3 this missing Microsoft.NETFramework.ReferenceAssemblies error gets resolved
Try out 3.2.3rc3 if you want to know this.
@Calinou I have tried it out with 3.2.3RC3 and this is what I experienced: the missing Microsoft.NETFramework.ReferenceAssemblies error becomes critical and I can no longer run and build Godot mono projects. Whereas in 3.2.2 this error only occurs when attempting to install packages with Nuget but building and running Godot mono projects still work fine.
I wasn't able to reproduce. Tried all build tools (except Mono's MSBuild which has different issues). Can you enable the option Mono > Builds > Print Build Output, try to build again and paste the full Godot command line output here?
Project "Rc 3 Proj.sln" (Restore target(s)):
Message: Building solution configuration "Debug|Any CPU".
Project "Rc 3 Proj.csproj" (_IsProjectRestoreSupported target(s)):
Done building project "Rc 3 Proj.csproj".
NuGetMessageTask: Determining projects to restore...
Project "Rc 3 Proj.csproj" (_GenerateRestoreProjectPathWalk target(s)):
Done building project "Rc 3 Proj.csproj".
Project "Rc 3 Proj.csproj" (_IsProjectRestoreSupported target(s)):
Done building project "Rc 3 Proj.csproj".
Project "Rc 3 Proj.csproj" (_GenerateRestoreGraphProjectEntry target(s)):
Done building project "Rc 3 Proj.csproj".
Project "Rc 3 Proj.csproj" (_GenerateProjectRestoreGraph target(s)):
Done building project "Rc 3 Proj.csproj".
RestoreTask: Restoring packages for C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj...
C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj(0,0): error NU1101: Unable to find package Microsoft.NETFramework.ReferenceAssemblies. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, Project Packages [C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.sln]
RestoreTask: Committing restore...
RestoreTask: Writing assets file to disk. Path: C:\Users\Classy\Desktop\rc3proj\.mono\temp\obj\project.assets.json
RestoreTask: Failed to restore C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj (in 250 ms).
RestoreTask:
RestoreTask: NuGet Config files used:
RestoreTask: C:\Users\Classy\AppData\Roaming\NuGet\NuGet.Config
RestoreTask: C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
RestoreTask: C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config
RestoreTask:
RestoreTask: Feeds used:
RestoreTask: C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
RestoreTask: C:\Users\Classy\Documents\Godot Projects\spaceServer\nugetPackages
Done building project "Rc 3 Proj.sln" -- FAILED.
Mono: Logfile is: C:\Users\Classy\AppData\Roaming/Godot/mono/mono_logs/2020_08_02 23.17.48 (17496).txt
Running: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe" "C:/Users/Classy/Desktop/rc3proj/Rc 3 Proj.sln" /restore /t:Build "/p:Configuration=Debug" /v:normal "/l:GodotTools.BuildLogger.GodotBuildLogger,C:\Users\Classy\Desktop\Godot_v3.2.3-rc3_mono_win64\GodotSharp\Tools\GodotTools.BuildLogger.dll;C:\Users\Classy\AppData\Roaming/Godot/mono/build_logs\3edfbb26a6d8ea195884877d0f192db3_Debug" /p:GodotDefineConstants="GODOT_WINDOWS;GODOT_64;"
Microsoft (R) Build Engine version 16.6.0+5ff7b0c9e for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
Build started 02/08/2020 23:18:18.
Project "C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.sln" on node 1 (Restore target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Debug|Any CPU".
_GetAllRestoreProjectPathItems:
Determining projects to restore...
Restore:
Restoring packages for C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj...
C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj : error NU1101: Unable to find package Microsoft.NETFramework.Referenc
eAssemblies. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, Project Packages [C
:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.sln]
Committing restore...
Generating MSBuild file C:\Users\Classy\Desktop\rc3proj\.mono\temp\obj\Rc 3 Proj.csproj.nuget.g.props.
Generating MSBuild file C:\Users\Classy\Desktop\rc3proj\.mono\temp\obj\Rc 3 Proj.csproj.nuget.g.targets.
Writing assets file to disk. Path: C:\Users\Classy\Desktop\rc3proj\.mono\temp\obj\project.assets.json
Failed to restore C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj (in 196 ms).
NuGet Config files used:
C:\Users\Classy\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
C:\Program Files (x86)\NuGet\Config\Xamarin.Offline.config
Feeds used:
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
C:\Users\Classy\Documents\Godot Projects\spaceServer\nugetPackages
Done Building Project "C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.sln" (Restore target(s)) -- FAILED.
Build FAILED.
"C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.sln" (Restore target) (1) ->
(Restore target) ->
C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.csproj : error NU1101: Unable to find package Microsoft.NETFramework.Refere
nceAssemblies. No packages exist with this id in source(s): Microsoft Visual Studio Offline Packages, Project Packages
[C:\Users\Classy\Desktop\rc3proj\Rc 3 Proj.sln]
0 Warning(s)
1 Error(s)
Time Elapsed 00:00:00.67
These are the error traces that I can find with Godot 3.2.3RC3.
Issue resolved! In Visual Studio with the RC3 project open I went to References > Manage Nuget Packages, and then looked for Microsoft.NETFramework.ReferenceAssemblies and just uninstalled it. Now the project can build and the hello world print from the C# script works. I did not manually add or install Microsoft.NETFramework.ReferenceAssemblies, it just gets there upon creation. I assume that this is fine to remove and won't break things. At least I haven't seen that it breaks stuff right now.
If there is nothing wrong with this solution then on my end you can close this issue. This has been the fix for me. If it turns out stuff does break I will report back. Thank you for your help guys it's been very valuable!
Most helpful comment
Unfortunately in order to extend Visual Studio to add functionality for Godot projects we need to the project to have a custom project type guid the extension can handle. At the same time if there's no extension that recognizes that project type guid then Visual Studio can't open the project at all.
It's very annoying because both MonoDevelop/VSMac and Rider allow the extension to use its own logic to detect whether to handle the project or not. But it's what it is, so starting with 3.2.3 in order to open the solution with VS you will need to install the extension: https://github.com/godotengine/godot-csharp-visualstudio/releases/tag/v1.1.1 (it will be available in the marketplace soon as well)