5

Currently I have a script that modifies nuget reference paths in old style csproj files. (for anyone that is interested this is due to building using different solutions which breaks the NuGet reference paths. I have reported it to Microsoft and it is currently in triage).

The script works correctly and does what I need it to, however I thought that this would be a good candidate for a Roslyn Analyzer with a Code fix.

I have played around with analysers and have been able to write several that can modify code within a project, but I am having great difficulty writing one that can work on the csproj file itself.

I have looked at workspaces (VisualStudioWorkspace and MSBuildWorkspace) however it seems to me that these will give you access to the various projects in a solution but will not give you access to the project file itself?

If anyone can give me a pointer to where/what I should be looking for, or if it is actually possible, i'd very much appreciate it.

Thank you

Reznoir
  • 909
  • 1
  • 11
  • 27
  • Did you find a solution? – Nils Aug 21 '20 at 18:35
  • 1
    I did not. I'm still interested to know if and how this is possible so if you figure it out please let me know. Good luck – Reznoir Aug 24 '20 at 11:59
  • https://stackoverflow.com/questions/23203206/roslyn-current-workspace-in-diagnostic-with-code-fix-project suggests that it is not possible. I solved my own "problem" by using a custom msbuild-task that fails when certain properties contradict my own "rules" – Nils Aug 25 '20 at 12:54

0 Answers0