I'm trying to make some refactorings in order to change namespace of some classes, create projects, etc.. using EnvDTE CodeModel.
I have tried various methods I found on the web, but nothing seems to work.
I'm using .Net 5.
For example, in this page are using directly DTE.Solution but when I try it on my solution, Intellisense gives me an error.
var solution = DTE.Solution;
Error: An object reference is required for the non-static field, method or property '_DTE.Solution'.
Another example I have found here is the following:
var dteInstance = serviceProvider.GetService(typeof(EnvDTE.DTE));
If I do that, the serviceProvider returns null to me. So I can't work with DTE.
I just need some help in order to get an instance of DTE, and later I would test all methods and properties that it gives me. But, how can I get the instance of DTE? How can I work with that?
I'm using an MVC web application to test it.
I appreciate so much your help.
question from:
https://stackoverflow.com/questions/65938501/refactoring-with-envdte-codemodel-on-net-5 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…