I try to create application responsible for analysing existing dll and generating output code based on this one. I created .netCore console application as entry point and several .netCore class libraries which incapsulating analysis and generating logic.
The first problem was detected whan i tried to add Mircosoft.Codeanalysis package referense:
Error Package Microsoft.Composition 1.0.27 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package Microsoft.Composition 1.0.27 supports: portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
This problem was solved by adding in .csproj file settings:
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+win81+wp8+wpa81</PackageTargetFallback>
It was enough to completing the first part of the application which generate output code, but when i tried to use MsBuildWorkspace.Create() method to get sln, projects and target classes from input dll, I had this error:
Error CS0103 The name 'MSBuildWorkspace' does not exist in the current context Roslyn.Codegen.WorkspaceParser
I suppose it is assotiate with with using Mircosoft.CodeAnalysis packag in .netCore application.
Unfortunately, I did't find any useful samples with .netCore apps and Roslyn to get best practices in this area and I'm not sure Roslyn and netCore have a good compatibility.
This is link to github repo: https://github.com/ddydeveloper/Roslyn.ApiClient.Codegen/tree/dev
So, is it good idea to mix Roslyn code analysis API and netCore applications? Could you give any good samples or advises how to fix problems with Roslyn and netCore compatibility?