![]() |
||||
|
Projects created with Visual Studio versions previous to Visual Studio 2008 targets a single .NET Framework version:
Visual Studio 2008 projects can target .NET Framework 2.0, .NET Framework 3.0 and .NET Framework 3.5 (last both are actually extensions to the .NET Framework 2.0, using the same CLR, etc.). You can specify the target .NET Framework:
This article explains how to get programmatically the target .NET Framework of an EnvDTE.Project from a Visual Studio macro or add-in. More Information To get the target .NET Framework of a Visual Studio 2008 project you must get the "TargetFramework" property from the EnvDTE.Project.Properties collection. The returned value is an unsigned integer which apparently doesn't make sense. However, when you convert it to hexadecimal notation, it can be 0x20000, 0x30000 or 0x30005, representing the .NET Framework 2.0, 3.0 or 3.0 respectively. The following macro shows the source code to get target .NET Framework:
Sub Test()
MessageBox.Show(GetTargetFramework(DTE.Solution.Projects.Item(1)))
End Sub
Function GetTargetFramework(ByVal objProject As EnvDTE.Project) As String
Dim iValue As Integer
iValue = CType(objProject.Properties.Item("TargetFramework").Value, Integer)
Return iValue.ToString("X")
End Function
Go back to the 'Resources for Visual Studio .NET extensibility' section for more articles like this
You can code, design, locate code and document your apps much faster using VB.NET, C#, C++ or Visual J#:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||