I have a solution where I have a Shared Project of extension ".shproj"
I need to add a class to the project with Roslyn, but when I look in the list of projects, It does not contain the shared project:
const string solutionTargetPath = @"C:\Repo\Solution.sln";
//Roslyn startup
MSBuildLocator.RegisterDefaults();
var workspace = MSBuildWorkspace.Create();
var solution = await workspace.OpenSolutionAsync(solutionTargetPath);
Project projectSilaeClientShared = solution.Projects.First(x => x.Name == "ProjectX.Shared");
I cannot even get the project directly from the filepath:
string projectFilePath = "C:\Repo\Shared.shproj";
MSBuildLocator.RegisterDefaults();
MSBuildWorkspace workspace = MSBuildWorkspace.Create();
Project project = workspace.OpenProjectAsync(projectFilePath).Result;
The error message says: (Immpossible to open the project ... as the extension ".shproj" is not associated to a language)
InnerException {"Impossible d'ouvrir le projet 'C:\Repo\Shared.shproj', car l'extension de fichier '.shproj' n'est pas associée à un langage."} System.Exception {System.InvalidOperationException}
How can I get the project with Roslyn and add the modifications?
Help!