MichaelMocko
MichaelMocko

Reputation: 6026

How to determinate Target Platform of project via EnvDTE.Project interface

I am trying to determinate the target platform of Visual Studio project via automation model. However i still do not succeed in this. Does anybody know how to obtain project's target platform with DTE (Any CPU/x86/x64)?

Upvotes: 1

Views: 831

Answers (1)

Rick Sladkey
Rick Sladkey

Reputation: 34240

Here is a Visual Studio macro that will print out the target platform of the active project to the macro output window when run with F5 from the macro IDE:

Public Sub ShowProjectPlatform()

    Dim project As Project = CType(CType(DTE.ActiveSolutionProjects, Object())(0), Project)
    System.Diagnostics.Debug.WriteLine("TargetPlatform = " & project.ConfigurationManager.ActiveConfiguration.Properties.Item("PlatformTarget").Value)

End Sub

Upvotes: 2

Related Questions