1

솔루션 내에서 많은 양의 프로젝트 (~ 80)를 수정하려면 일부 VS2005 IDE 매크로를 사용하고 있습니다. 설정하려는 속성 중 일부는 프로그래밍 인터페이스를 '기본'으로 표시하지만 다른 대부분의 인터페이스는 프로그래밍 인터페이스를 제공하지 않습니다. 이러한 속성을 기본값으로 설정하는 일반적인 방법이 있습니까? 어떤 임의의 속성을 설정,VCProject 속성을 기본값으로 설정

간단한 예를 (결국 된 .vcproj 파일에서이를 삭제하는 의미) :

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 

어떤 조언을 주시면 감사하겠습니다.

답변

2

VS 2005의 경우 VCConfiguration에서 ClearToolProperty 메서드를 사용할 수 있다고 생각합니다. 다음 코드는 (이 C#을,하지만 난 VB에 대한 확인 뭔가 비슷한 일을 해요) CallingConvention 위해이 작업을 수행 할 것입니다 :

cfg.ClearToolProperty(toolCompiler, "CallingConvention"); 

은 GUI로 가서이 옵션 "<inherit from parent or project defaults>"을 선택하는 것과 같은 효과를 가질 것이다.

불행히도 이것은 VS 2010에서 사용되지 않는 것으로 보입니다. 새로운 지원되는 방법이 무엇인지 잘 모르겠습니다.

+1

VS2010의 경우 [이 포럼 게시물] (http://social.msdn.microsoft.com/Forums/en-IE/vsx/thread/8dff2053-432f-4bdd-b668-3c88960e1409)은 도구 개체를 새 [IVCRulePropertyStorage] (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.vcprojectengine.ivcrulepropertystorage.aspx) 인터페이스에 추가 한 다음 DeleteProperty 메서드를 사용하여 해당 속성을 제거하십시오. 그래도 나 자신을 시험해 볼 수 없었다. –

관련 문제