Error when trying to open any C# script from the editor

Hi all,

Trying out Flax for the first time, but having issue opening C# scripts.

When I try to open one I get the the following error:

[Warning] Cannot open file ‘C:\Users/Brian/Documents/Flax Projects/FlaxSamples/BasicTemplate/Source/BasicTemplate/test.cs’:0. “VisualStudio::OpenInstance - CoCreateInstance” failed with result: -2147221164

Anyone seen this before?


Could you try to use option in Editor menu File -> Generate scripts project files and then open Visual Studio?
Also, which version do you use? VS2017 and VS2019 are widely tested to work fine.

Thanks for getting back to me.

I’m using VS 2017.

I still see the same issue after doing what you recommended. I tried to open the project solution directly in VS 2017, I got an error saying that this project targets .Net 4.5, which is not installed, so I installed .Net 5 (4.5 was not available to download). I was then able to open the solution after retargeting.
After this I was able to open scripts in VS 2017 directly.


[Warning] Cannot open file ‘e:\Flax Projects/MyProject/Source/MyCS/aaa.cs’:0. “VisualStudio::OpenFile - DTE->get_IsOpenFile” failed with result: -2147220995

me too…

also can’t find the .cs file In VS2019…

Regenerate C# project should help.