1

I have a project which I am using as a simple testbed for a graphical application. I am attempting to add a shared project file (.shproj), but whenever I try to edit the project's dependencies, I get a dialog which says:

---------------------------
Microsoft Visual Studio
---------------------------
String value '

      ' cannot be translated to any value from type System.Guid.
---------------------------
OK   
---------------------------

This happens if I right-click on my project and select either **Add Project Reference..." or "Add Shared Project Reference..."

enter image description here

enter image description here

Unfortunately I do not have this project as part of source control so I can't go back in time to see what may have caused this problem. I have attempted to undo the operations which may have gotten me into this state (such as adding the .shproj to my solution) but the dialog still appears when I attempt to edit the dependencies.

I haven't been able to find anything online about this error, and I suspect it's happening because something is malformed in either my .csproj or the .sln, but I'm not sure where to look or what to try to solve this.

I am running Visual Studio 2022 (17.4.2).

I have tried opening the project in Visual Studio 2019 and I can edit the dependencies there. I can also add and remove nuget packages. Note that if I modify the dependencies in Visual Studio 2019, the project will correctly load and build in 2022 so I do have a workaround. However, it would be nice to know why the project dependencies cannot be edited in 2022.

Victor Chelaru
  • 4,491
  • 3
  • 35
  • 49

1 Answers1

0

It turns out that empty Project tags caused problems in the .csproj file.

My .csproj file referenced other .csproj files and these references included empty Project tags.

Here is a snippet before the fix:

<ProjectReference Include="../../../GitHub/FlatRedBall/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj">
  <Name>FlatRedBallDesktopGLNet6</Name>
  <Project>
  </Project>
</ProjectReference>

Removing the Project tags solves this problem, as shown in the following code:

<ProjectReference Include="../../../GitHub/FlatRedBall/Engines/FlatRedBallXNA/FlatRedBallDesktopGLNet6/FlatRedBallDesktopGLNet6.csproj">
  <Name>FlatRedBallDesktopGLNet6</Name>
</ProjectReference>
Victor Chelaru
  • 4,491
  • 3
  • 35
  • 49