This project is read-only.

How to get 'ProjectGuid' from Rosylyn API

Topics: APIs
Jan 9, 2015 at 10:51 AM
Hi! I am using MSBuildWorkspace to open a solution and it's projects. I want to get original 'ProjectGuid' which is specified in *.csproj file via Microsoft.CodeAnalysis.Project objects?

I found in source Microsoft.CodeAnalysis.MSBuild.ProjectFile which have Guid property but this class is internal and i cannot get to it.

Is there a way to get this information.

Best regards, Michal.
Jan 14, 2015 at 6:23 AM
Edited Jan 14, 2015 at 6:24 AM
The project Guid is not exposed through any API. It does exist in the project file and is assign into the field in the internal ProjectFile type, but it is not used anywhere for MSBuildWorkspace. It's current existence in ProjectFile is just legacy that should get removed.

If you really need this Guid you might want to use the MSBuild API directly.
Marked as answer by MichalMoc on 1/15/2015 at 5:42 AM