Roslyn : Get Current Project / Get Current Doc that is selected

Viewed 2175

I'm developing a code gen (VSIX) for my team and I'm intendedly using Roslyn as a fundamental engine after I have struggling with VSIX extensibility framework.

My code gen is currently able generate a new csproj for the solution and able to churn out boilerplate code base based on Templating project from VSIX extensibility. As ambitious I am, I'm trying not to rely on static templating project and use Roslyn to churn out the code instead.

My solution has a list of folders and each folder has a list of csproj.

My Question 1 is I'm trying to use Roslyn Workspace API to detect the current document (.cs) that has been open in code editor or am trying to get the current doc id of the selected cs file I right click from the solution explorer.

I have tried to use AdhocWorkspace which so far have failed as I'm not able to get any.

Question 2: If I were to use AdhocWorkspace, am I able to change the default namespace in the csproj properties? Or was it not part of the functionalities in Roslyn Workspace API at the moment?

Thanks.

1 Answers
Related