Setting a VCProject property to default

I'm trying some VS2005 IDE macros to modify a large amount of projects (~80) within a solution. Some of the properties I wish to set do expose a programmatic interface to 'default', but many others do not. Is there a generic way to set such properties to their default? (eventually meaning erasing them from the .vcproj file)

Simplified example, setting some random properties:

   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

Any advice would be appreciated.

Answers


For VS 2005, I believe you can use the ClearToolProperty method on VCConfiguration. The following code would accomplish this for CallingConvention (this is C#, but I'm sure something similar works for VB):

cfg.ClearToolProperty( toolCompiler, "CallingConvention" );

This would have the same effect as going into the GUI and choosing "<inherit from parent or project defaults>" for this option.

Unfortunately this seems to be deprecated in VS 2010, and I'm not sure what the new supported method is.


Need Your Help

WinCE vs. Win32 dlls

dll winapi windows-ce

I have some COM and some native dlls that are compiled for a Win CE device that I have. I would like to take a look at them, so I can create an application that references them and extends the

(Networking) XM6i emulating NetBSD 4.0.1 x68k

virtual-machine 68000 netbsd

I have installed NetBSD 4.0.1 x68k on XM6i (http://www.ceres.dti.ne.jp/tsutsui/netbsd/x68k/NetBSD-x68k-on-XM6i.html) as a virtual machine emulating a 68030 platform. I have gotten everything to work