Delphi – What are the MSBuild project level properties for Delphi

delphidelphi-2010msbuild

The Delphi documentation for MSBuild says

/property:name=value sets or overrides
project-level properties, where name
is the property name and value is the
property value. Use a semicolon or a
comma to separate multiple properties,
or specify each property separately.
/p is also acceptable. For example:

/property:WarningLevel=2;OutputDir=bin\Debug

I can't find a list of available properties, here's what I know so far:

  • WarningLevel
  • OutputDir (dcc32 -e equivalent)
  • Config

I'd like to get a complete list, but I'm most interested in being able to override the Defines (dcc32 -d equivalent). And if these can be lined up against dcc32 equivalents that'd be icing!

Best Answer

You can find most of the parameters in the msbuild script C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Borland.Delphi.Targets when you look at the CoreCompile target.

        ExeOutput="$(DCC_ExeOutput)"
        BplOutput="$(DCC_BplOutput)"
        DcuOutput="$(DCC_DcuOutput)"
        DcpOutput="$(DCC_DcpOutput)"
        HppOutput="$(DCC_HppOutput)"
        ObjOutput="$(DCC_ObjOutput)"
        BpiOutput="$(DCC_BpiOutput)"

        DependencyCheckOutputName = "$(DCC_DependencyCheckOutputName)"
        UnitSearchPath="$(UnitSearchPath)"
        ResourcePath="$(ResourcePath)"
        IncludePath="$(IncludePath)"
        ObjPath="$(_ObjectPath)"

        UnitAlias="$(DCC_UnitAlias)"
        ConsoleTarget="$(DCC_ConsoleTarget)"
        Define="$(DCC_Define)"
        FindError="$(DCC_FindError)"
        MapFile="$(DCC_MapFile)"
        Hints="$(DCC_Hints)"
        CBuilderOutput="$(DCC_CBuilderOutput)"
        BaseAddress="$(DCC_BaseAddress)"
        UsePackage="$(_UsePackage)"
        MakeModifiedUnits="$(DCC_MakeModifiedUnits)"
        BuildAllUnits="$(DCC_BuildAllUnits)"
        NameSpace="$(NameSpace)"
        OldDosFileNames="$(DCC_OldDosFileNames)"
        Quiet="$(DCC_Quiet)"
        DebugInfoInExe="$(DCC_DebugInfoInExe)"
        DebugVN="$(DCC_DebugVN)"
        RemoteDebug="$(DCC_RemoteDebug)"
        OutputNeverBuildDcps="$(DCC_OutputNeverBuildDcps)"
        NoConfig="true"
        OutputDRCFile="$(DCC_OutputDRCFile)"
        OutputDependencies="$(DCC_OutputDependencies)"
        OutputXMLDocumentation="$(DCC_OutputXMLDocumentation)"
        DefaultNamespace="$(DCC_DefaultNamespace)"
        Platform="$(DCC_Platform)"
        UnsafeCode="$(DCC_UnsafeCode)"
        Warnings="$(DCC_Warnings)"

        Alignment="$(DCC_Alignment)"
        MinimumEnumSize="$(DCC_MinimumEnumSize)"
        FullBooleanEvaluations="$(DCC_FullBooleanEvaluations)"
        AssertionsAtRuntime="$(DCC_AssertionsAtRuntime)"
        DebugInformation="$(DCC_DebugInformation)"
        ImportedDataReferences="$(DCC_ImportedDataReferences)"
        LongStrings="$(DCC_LongStrings)"
        IOChecking="$(DCC_IOChecking)"
        WriteableConstants="$(DCC_WriteableConstants)"
        LocalDebugSymbols="$(DCC_LocalDebugSymbols)"
        RunTimeTypeInfo="$(DCC_RunTimeTypeInfo)"
        Optimize="$(DCC_Optimize)"
        OpenStringParams="$(DCC_OpenStringParams)"
        IntegerOverflowCheck="$(DCC_IntegerOverflowCheck)"
        RangeChecking="$(DCC_RangeChecking)"
        TypedAtParameter="$(DCC_TypedAtParameter)"
        PentiumSafeDivide="$(DCC_PentiumSafeDivide)"
        StrictVarStrings="$(DCC_StrictVarStrings)"
        GenerateStackFrames="$(DCC_GenerateStackFrames)"
        ExtendedSyntax="$(DCC_ExtendedSyntax)"
        SymbolReferenceInfo="$(DCC_SymbolReferenceInfo)"

        StackSize="$(DCC_StackSize)"
        ImageBase="$(DCC_ImageBase)"
        Description="$(DCC_Description)"

        DelaySign="$(DCC_DelaySign)"
        KeyFile="$(DCC_KeyFile)"
        KeyContainer="$(DCC_KetContainer)"
        CodePage="$(DCC_CodePage)"

        SYMBOL_DEPRECATED="$(DCC_SYMBOL_DEPRECATED)"
        SYMBOL_LIBRARY="$(DCC_SYMBOL_LIBRARY)"
        SYMBOL_PLATFORM="$(DCC_SYMBOL_PLATFORM)"
        SYMBOL_EXPERIMENTAL="$(DCC_SYMBOL_EXPERIMENTAL)"
        UNIT_LIBRARY="$(DCC_UNIT_LIBRARY)"
        UNIT_PLATFORM="$(DCC_UNIT_PLATFORM)"
        UNIT_DEPRECATED="$(DCC_UNIT_DEPRECATED)"
        UNIT_EXPERIMENTAL="$(DCC_UNIT_EXPERIMENTAL)"
        HRESULT_COMPAT="$(DCC_HRESULT_COMPAT)"
        HIDING_MEMBER="$(DCC_HIDING_MEMBER)"
        HIDDEN_VIRTUAL="$(DCC_HIDDEN_VIRTUAL)"
        GARBAGE="$(DCC_GARBAGE)"
        BOUNDS_ERROR="$(DCC_BOUNDS_ERROR)"
        ZERO_NIL_COMPAT="$(DCC_ZERO_NIL_COMPAT)"
        STRING_CONST_TRUNCED="$(DCC_STRING_CONST_TRUNCED)"
        FOR_LOOP_VAR_VARPAR="$(DCC_FOR_LOOP_VAR_VARPAR)"
        TYPED_CONST_VARPAR="$(DCC_TYPED_CONST_VARPAR)"
        ASG_TO_TYPED_CONST="$(DCC_ASG_TO_TYPED_CONST)"
        CASE_LABEL_RANGE="$(DCC_CASE_LABEL_RANGE)"
        FOR_VARIABLE="$(DCC_FOR_VARIABLE)"
        CONSTRUCTING_ABSTRACT="$(DCC_CONSTRUCTING_ABSTRACT)"
        COMPARISON_FALSE="$(DCC_COMPARISON_FALSE)"
        COMPARISON_TRUE="$(DCC_COMPARISON_TRUE)"
        COMPARING_SIGNED_UNSIGNED="$(DCC_COMPARING_SIGNED_UNSIGNED)"
        COMBINING_SIGNED_UNSIGNED="$(DCC_COMBINING_SIGNED_UNSIGNED)"
        UNSUPPORTED_CONSTRUCT="$(DCC_UNSUPPORTED_CONSTRUCT)"
        FILE_OPEN="$(DCC_FILE_OPEN)"
        FILE_OPEN_UNITSRC="$(DCC_FILE_OPEN_UNITSRC)"
        BAD_GLOBAL_SYMBOL="$(DCC_BAD_GLOBAL_SYMBOL)"
        DUPLICATE_CTOR_DTOR="$(DCC_DUPLICATE_CTOR_DTOR)"
        INVALID_DIRECTIVE="$(DCC_INVALID_DIRECTIVE)"
        PACKAGE_NO_LINK="$(DCC_PACKAGE_NO_LINK)"
        PACKAGED_THREADVAR="$(DCC_PACKAGED_THREADVAR)"
        IMPLICIT_IMPORT="$(DCC_IMPLICIT_IMPORT)"
        HPPEMIT_IGNORED="$(DCC_HPPEMIT_IGNORED)"
        NO_RETVAL="$(DCC_NO_RETVAL)"
        USE_BEFORE_DEF="$(DCC_USE_BEFORE_DEF)"
        FOR_LOOP_VAR_UNDEF="$(DCC_FOR_LOOP_VAR_UNDEF)"
        UNIT_NAME_MISMATCH="$(DCC_UNIT_NAME_MISMATCH)"
        NO_CFG_FILE_FOUND="$(DCC_NO_CFG_FILE_FOUND)"
        IMPLICIT_VARIANTS="$(DCC_IMPLICIT_VARIANTS)"
        UNICODE_TO_LOCALE="$(DCC_UNICODE_TO_LOCALE)"
        LOCALE_TO_UNICODE="$(DCC_LOCALE_TO_UNICODE)"
        IMAGEBASE_MULTIPLE="$(DCC_IMAGEBASE_MULTIPLE)"
        SUSPICIOUS_TYPECAST="$(DCC_SUSPICIOUS_TYPECAST)"
        PRIVATE_PROPACCESSOR="$(DCC_PRIVATE_PROPACCESSOR)"
        UNSAFE_TYPE="$(DCC_UNSAFE_TYPE)"
        UNSAFE_CODE="$(DCC_UNSAFE_CODE)"
        UNSAFE_CAST="$(DCC_UNSAFE_CAST)"
        OPTION_TRUNCATED="$(DCC_OPTION_TRUNCATED)"
        WIDECHAR_REDUCED="$(DCC_WIDECHAR_REDUCED)"
        DUPLICATES_IGNORED="$(DCC_DUPLICATES_IGNORED)"
        UNIT_INIT_SEQ="$(DCC_UNIT_INIT_SEQ)"
        LOCAL_PINVOKE="$(DCC_LOCAL_PINVOKE)"
        MESSAGE_DIRECTIVE="$(DCC_MESSAGE_DIRECTIVE)"
        TYPEINFO_IMPLICITLY_ADDED="$(DCC_TYPEINFO_IMPLICITLY_ADDED)"
        XML_WHITESPACE_NOT_ALLOWED="$(DCC_XML_WHITESPACE_NOT_ALLOWED)"
        XML_UNKNOWN_ENTITY="$(DCC_XML_UNKNOWN_ENTITY)"
        XML_INVALID_NAME_START="$(DCC_XML_INVALID_NAME_START)"
        XML_INVALID_NAME="$(DCC_XML_INVALID_NAME)"
        XML_EXPECTED_CHARACTER="$(DCC_XML_EXPECTED_CHARACTER)"
        XML_CREF_NO_RESOLVE="$(DCC_XML_CREF_NO_RESOLVE)"
        XML_NO_PARM="$(DCC_XML_NO_PARM)"
        XML_NO_MATCHING_PARM="$(DCC_XML_NO_MATCHING_PARM)"

So to set the defines you could use the DCC_Define parameter like this:

msbuild yourproject.dproj /p:DCC_Define=MY_DEFINE

Others you will find in the .dproj file of your project

<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>

So it is Configuration and not Config. At least in Delphi 2007.

You might want to learn more about msbuild in general to understand the scripts better and learn how you could make your own msbuild scripts to drive a build machine.

Disclaimer: This information is from a Delphi 2007 setup