Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
302 views
in Technique[技术] by (71.8m points)

visual studio - Refactoring with EnvDTE CodeModel on .Net 5

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...