Reputation: 19330
We have large solutions that have both vb and c# projects. We're on the path of converting some of vb to c#. After the conversion, when solution is opened using vs2017 project is still shows as vb. We can build it but code is unusable. We have the fix - remove project from solution and re-add it. Voila - it shows as csproj. But this creates new issue - since we're using DLL references, we have to manually set build order. Build order is broken when project is removed.
My thinking was that solution must be caches something somewhere. I removed .vs
, cleaned solution, removed all obj
folders, no matter what I cleaned out, until you re-add project, a c# project shows as vb project. I also checked c:\users\username\...
for any files that can relate to my solution and found nothing.
I hate do re-add and fix build order many times (conversions will not happen all at once). Why VS is not recognizing file right-away? After re-add, project file is not changed and solution doesn't have any sign of something different.
Upvotes: 0
Views: 1091
Reputation: 19330
Found the issue
The GUID in solution file is actually project type GUID.
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "projectname", "projectname.vbproj", "{7CC2FC9A-0D8F-4A26-A891-80B1D20C773D}"
EndProject
Above, Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}")
is project type GUID;
and "{7CC2FC9A-0D8F-4A26-A891-80B1D20C773D}"
is project ID GUID.
So, when in solution we change extension vbproj
to csproj
, we also need to change GUID with correct one. This solves the issue.
Upvotes: 2