How to change platformtarget for multiple projects and solutions?
I am using visual studio 2010 professional edition. I have a number of projects and solutions with the PlatformTarget set to x86 and i need to change that to AnyCPU.
It is not feasible to do it manual开发者_高级运维ly, since there are too many projects, so i was wondering if there is an existing macro or script that can do the conversion automatically for all projects.
If there is no such macro/script and i have to write a conversion application myself, what would be a good way to perform this conversion (simple string replace in the csproj files or is there a better way)?
Sub ChangePlatformTarget()
For Each proj As Project In DTE.Solution.Projects
Debug.WriteLine(proj.Name)
If Not proj.ConfigurationManager Is Nothing Then
ChangeProject(proj)
Else
'it's a folder, do something else with it...
End If
Next
End Sub
Sub ChangeProject(proj As Project
Dim prop As [Property] = proj.ConfigurationManager.ActiveConfiguration.Properties.Item("PlatformTarget")
prop.Value = "AnyCPU"
End Sub
精彩评论