VB.NET – Access Visual Studio 2010 project properties in Visual Basic Macro

My company does a lot of work on LINT, so in order to make our lives easier, we wrote some macros in Visual Studio so that we can easily compile LINT files. But , We ran into a problem. Due to changes in the format of the Visual Studio 2010 solution file, our macros are no longer valid, so my company made me responsible for updating them.
My problem comes from here. I am trying to access the macros The preprocessor definition of the currently selected VS project in the VS project, but the name used in the project property page does not appear in the code. I have been searching online trying to find a way to access this information in my code, but I All the answers I found pointed in the wrong direction.
I think the classes I should use are the DTE.Project and DTE.Configuration classes.
Any ideas on how I can get the information I am looking for in the code?

Edit: I know (thanks to http://msdn.microsoft.com/en-us/library/aa984571(v=vs.71).aspx) through the ProjectProperties interface there is no property Direct programmatic access, but this is not impossible.

Edit: The object properties of the Project and Configuration classes do not match the properties displayed in the Project Properties UI. The property I am searching for may exist in one of the properties May also exist in different classes

After talking with my boss, we decided Going in the direction of the VS add-in, because Damien_The_Unbeliever is correct. However, I soon encountered the same problem in C# as in VB.
It was solved by stupid metaprogramming.
http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/23763118-c34f-45fc-97aa-5fe5c4ad4d5c/
For others who encounter this problem, this is what I am The only useful link found in two days of searching.

I hope to explain:)

My company does it on LINT A lot of work, so in order to make our lives easier, we wrote some macros in Visual Studio, so that we can easily compile LINT files. However, we encountered a problem. Due to the format of the Visual Studio 2010 solution file happened Changes, our macros are no longer valid, so my company makes me responsible for updating them.
My question comes from here. I am trying to access the preprocessor definition of the currently selected VS project in the macro, but in the project properties page The name used does not appear in the code. I have been searching online trying to find a way to access this information in my code, but all the answers I found pointed in the wrong direction.
I think I should The classes used are the DTE.Project and DTE.Configuration classes.
Any ideas on how I can get the information I am looking for in the code?

Edit: I know (thanks to http://msdn.microsoft.com/en-us/library/aa984571(v=vs.71).aspx) through the ProjectProperties interface there is no property Direct programmatic access, but this is not impossible.

Edit: The object properties of the Project and Configuration classes do not match the properties displayed in the Project Properties UI. The property I am searching for may exist in one of the properties It may also exist in different classes

After talking with my boss, we decided to move in the direction of the VS add-in, because Damien_The_Unbeliever is Correct. However, I soon encountered the same problem in C# as in VB.
It was solved by stupid metaprogramming.
http://social.msdn.microsoft.com/ Forums/en-US/vsx/thread/23763118-c34f-45fc-97aa-5fe5c4ad4d5c/
For others who have encountered this problem, this is the only useful link I found in two days of searching. < p>

I hope to explain:)

Leave a Comment

Your email address will not be published.