c# - 'Expected Global Line.' exception while loading solution using Roslyn -


i'm learning roslyn , trying out first time. i've written small code snippet load solution , reference workspace.

iworkspace workspace = workspace.loadsolution(solutionpath);  foreach (iproject project in workspace.currentsolution.projects) {     commoncompilation objcompilation = project.getcompilation(); } return workspace; 

but i'm getting exception in first line. exception details given below.

message : expected global line.

stack trace :
@ roslyn.services.host.solutionfile.parseglobal(textreader reader)
@ roslyn.services.host.solutionfile.parse(textreader reader)
@ roslyn.services.host.loadedworkspace.loadsolution(solutionid solutionid, string filepath)
@ roslyn.services.host.loadedworkspace.opensolution(string filename)
@ roslyn.services.host.loadedworkspace.loadsolution(string solutionfilename, string configuration, string platform, boolean enablefiletracking)
@ roslyn.services.workspace.loadsolution(string solutionfilename, string configuration, string platform, boolean enablefiletracking)
@ ros2.program.getworkspace(string solutionpath) in c:\users\amnatu\documents\visual studio 2015\projects\ros2\ros2\program.cs:line 30

i referred link shows same issue faced. however, solution of removing space between endproject , global isn't applicable in case solution file doesn't have space between them.

am missing here?
any suggestions on how resolve issue?

apologies delayed response. comment @joshvarty helped me understand issue.

i indeed using out dated version , had use latest microsoft.codeanalysis library. after made these changes , updated classes accordingly, worked perfectly.

thanks joshvarty.!


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -