J'essaie certaines macros IDE VS2005 pour modifier une grande quantité de projets (~ 80) dans une solution. Certaines des propriétés que je souhaite définir exposent une interface programmatique à 'default', mais beaucoup d'autres ne le font pas. Existe-t-il un moyen générique de définir ces propriétés à leur valeur par défaut? (Éventuellement à-dire les effacer du fichier .vcproj)Définition d'une propriété VCProject par défaut
exemple simplifié, certaines propriétés aléatoires réglage:
Sub SetSomeProps()
Dim prj As VCProject
Dim cfg As VCConfiguration
Dim toolCompiler As VCCLCompilerTool
Dim toolLinker As VCLinkerTool
Dim EnvPrj As EnvDTE.Project
For Each EnvPrj In DTE.Solution.Projects
prj = EnvPrj.Object
cfg = prj.Configurations.Item(1)
toolLinker = cfg.Tools("VCLinkerTool")
If toolLinker IsNot Nothing Then
' Some tool props that expose a *default* interface'
toolLinker.EnableCOMDATFolding = optFoldingType.optFoldingDefault
toolLinker.OptimizeReferences = optRefType.optReferencesDefault
toolLinker.OptimizeForWindows98 = optWin98Type.optWin98Default
End If
toolCompiler = cfg.Tools("VCCLCompilerTool")
If toolCompiler IsNot Nothing Then
' How to set it to default? (*erase* the property from the .vcproj)'
toolCompiler.CallingConvention = callingConventionOption.callConventionCDecl
toolCompiler.WholeProgramOptimization = False
toolCompiler.Detect64BitPortabilityProblems = False
End If
Next
End Sub
Tout conseil serait apprécié.
Pour VS2010, [ce message sur le forum] (http://social.msdn.microsoft.com/Forums/fr/vsx/thread/8dff2053-432f-4bdd-b668-3c88960e1409) suggère que vous pouvez lancer le objet outil à la nouvelle interface [IVCRulePropertyStorage] (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vcprojectengine.ivcrulepropertystorage.aspx), puis utilisez sa méthode DeleteProperty pour se débarrasser de la propriété. Cependant, je n'ai pas été capable de l'essayer moi-même. –