Programmer
Programmer

Reputation: 6753

Meaning of $(OutDir)

I was looking in the properties of my visual studio project and saw the following:

$(OutDir)\$(ProjectName).exe

I was curious how does visual studio know the value of outdir and how can i see this value. Moreover, which language is this, eg C#, python? In other words, what language is $(OutDir)\$(ProjectName).exe written in

Upvotes: 27

Views: 35650

Answers (4)

Phil Jollans
Phil Jollans

Reputation: 3769

These macros are documented by Microsoft in the topic Macros for Build Commands and Properties. (That link is for Visual Studio 2015.)

Upvotes: 7

fraa
fraa

Reputation: 9

You can modify the file the_name_of_your_prog.VCPROJ (in the example : ttfmfc)

and replace : $(SolutionDir)$(ConfigurationName) and $(SolutionDir) by F:\debug (F:\debug is in a ramdisk, or any other foler)

In the example below, only debug configuration has been changed :
visual studio 2008 replace every [ by (lower than sign) and ] by (greater than sign)

[?xml version="1.0" encoding="Windows-1252"?]

[VisualStudioProject
    ProjectType="Visual C++"
    Version="9.00"
    Name="ttsmfc"
    ProjectGUID="{0B52B3C5-7AD5-4780-92E9-98674E486261}"
    RootNamespace="ttsmfc"
    Keyword="MFCProj"
    TargetFrameworkVersion="196613"
    ]

    [Platforms]

        [Platform
            Name="Win32"
        /]

    [/Platforms]

    [ToolFiles]

    [/ToolFiles]

    [Configurations]

        [Configuration
            Name="Debug|Win32"
            OutputDirectory="F:\Debug"
            IntermediateDirectory="F:\Debug"
            ConfigurationType="1"
            UseOfMFC="2"
            CharacterSet="1"
            ]

            [Tool
                Name="VCPreBuildEventTool"
            /]

            [Tool
                Name="VCCustomBuildTool"
            /]

            [Tool
                Name="VCXMLDataGeneratorTool"
            /]

            [Tool
                Name="VCWebServiceProxyGeneratorTool"
            /]

            [Tool
                Name="VCMIDLTool"
                PreprocessorDefinitions="_DEBUG"
                MkTypLibCompatible="true"
                SuppressStartupBanner="true"
                TargetEnvironment="1"
                TypeLibraryName="f:\Debug/ort.tlb"
                HeaderFileName=""
            /]

            [Tool
                Name="VCCLCompilerTool"
                Optimization="0"
                PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG"
                MinimalRebuild="true"
                BasicRuntimeChecks="3"
                RuntimeLibrary="3"
                UsePrecompiledHeader="2"
                PrecompiledHeaderThrough="stdafx.h"
                PrecompiledHeaderFile="F:\Debug/ort.pch"
                AssemblerListingLocation="F:\Debug/"
                ObjectFile="F:\Debug/"
                ProgramDataBaseFileName="F:\Debug/"
                WarningLevel="3"
                DebugInformationFormat="4"
            /]

            [Tool
                Name="VCManagedResourceCompilerTool"
            /]

            [Tool
                Name="VCResourceCompilerTool"
                PreprocessorDefinitions="_DEBUG"
                Culture="1036"
                AdditionalIncludeDirectories="$(IntDir)"
            /]

            [Tool
                Name="VCPreLinkEventTool"
            /]

            [Tool
                Name="VCLinkerTool"
                AdditionalDependencies="winmm.lib"
                LinkIncremental="2"
                GenerateDebugInformation="true"
                SubSystem="2"
                TargetMachine="1"
            /]

            [Tool
                Name="VCALinkTool"
            /]

            [Tool
                Name="VCManifestTool"
            /]

            [Tool
                Name="VCXDCMakeTool"
            /]

            [Tool
                Name="VCBscMakeTool"
            /]

            [Tool
                Name="VCFxCopTool"
            /]

            [Tool
                Name="VCAppVerifierTool"
            /]

            [Tool
                Name="VCPostBuildEventTool"
            /]

        [/Configuration]

        [Configuration
            Name="Release|Win32"
            OutputDirectory="$(SolutionDir)$(ConfigurationName)"
            IntermediateDirectory="$(ConfigurationName)"
            ConfigurationType="1"
            UseOfMFC="2"
            CharacterSet="1"
            WholeProgramOptimization="1"
            ]

            [Tool
                Name="VCPreBuildEventTool"
            /]

            [Tool
                Name="VCCustomBuildTool"
            /]

            [Tool
                Name="VCXMLDataGeneratorTool"
            /]

            [Tool
                Name="VCWebServiceProxyGeneratorTool"
            /]

            [Tool
                Name="VCMIDLTool"
                PreprocessorDefinitions="NDEBUG"
                MkTypLibCompatible="false"
                ValidateParameters="true"
            /]

            [Tool
                Name="VCCLCompilerTool"
                Optimization="2"
                EnableIntrinsicFunctions="true"
                PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG"
                MinimalRebuild="false"
                RuntimeLibrary="2"
                EnableFunctionLevelLinking="true"
                UsePrecompiledHeader="2"
                WarningLevel="3"
                DebugInformationFormat="3"
            /]

            [Tool
                Name="VCManagedResourceCompilerTool"
            /]

            [Tool
                Name="VCResourceCompilerTool"
                PreprocessorDefinitions="NDEBUG"
                Culture="1036"
                AdditionalIncludeDirectories="$(IntDir)"
            /]

            [Tool
                Name="VCPreLinkEventTool"
            /]

            [Tool
                Name="VCLinkerTool"
                AdditionalDependencies="winmm.lib"
                LinkIncremental="1"
                GenerateDebugInformation="true"
                SubSystem="2"
                OptimizeReferences="2"
                EnableCOMDATFolding="2"
                TargetMachine="1"
            /]

            [Tool
                Name="VCALinkTool"
            /]

            [Tool
                Name="VCManifestTool"
            /]

            [Tool
                Name="VCXDCMakeTool"
            /]

            [Tool
                Name="VCBscMakeTool"
            /]

            [Tool
                Name="VCFxCopTool"
            /]

            [Tool
                Name="VCAppVerifierTool"
            /]

            [Tool
                Name="VCPostBuildEventTool"
            /]

        [/Configuration]

    [/Configurations]

    [References]

    [/References]

    [Files]

        [Filter
            Name="Fichiers sources"
            Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
            UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
            ]

            [File
                RelativePath=".\Buffer.cpp"
                ]

            [/File]

            [File
                RelativePath=".\ChangeRes.cpp"
                ]

            [/File]

            [File
                RelativePath=".\errorprint.cpp"
                ]

            [/File]

            [File
                RelativePath=".\MainFrm.cpp"
                ]

            [/File]

            [File
                RelativePath=".\Mot.cpp"
                ]

            [/File]

            [File
                RelativePath=".\Pipe.cpp"
                ]

            [/File]

            [File
                RelativePath=".\PtrFifo.cpp"
                ]

            [/File]

            [File
                RelativePath=".\Reco.cpp"
                ]

            [/File]

            [File
                RelativePath=".\SoundBase.cpp"
                ]

            [/File]

            [File
                RelativePath=".\SoundFile.cpp"
                ]

            [/File]

            [File
                RelativePath=".\SoundIn.cpp"
                ]

            [/File]

            [File
                RelativePath=".\SoundOut.cpp"
                ]

            [/File]

            [File
                RelativePath=".\stdafx.cpp"
                ]

                [FileConfiguration
                    Name="Debug|Win32"
                    ]

                    [Tool
                        Name="VCCLCompilerTool"
                        UsePrecompiledHeader="1"
                    /]

                [/FileConfiguration]

                [FileConfiguration
                    Name="Release|Win32"
                    ]

                    [Tool
                        Name="VCCLCompilerTool"
                        UsePrecompiledHeader="1"
                    /]

                [/FileConfiguration]

            [/File]

            [File
                RelativePath=".\ttsmfc.cpp"
                ]

            [/File]

            [File
                RelativePath=".\ttsmfcDoc.cpp"
                ]

            [/File]

            [File
                RelativePath=".\ttsmfcView.cpp"
                ]

            [/File]

            [File
                RelativePath=".\vegView.cpp"
                ]

            [/File]

        [/Filter]

        [Filter
            Name="Fichiers d'en-tête"
            Filter="h;hpp;hxx;hm;inl;inc;xsd"
            UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
            ]

            [File
                RelativePath=".\Buffer.h"
                ]

            [/File]

            [File
                RelativePath=".\errorprint.h"
                ]

            [/File]

            [File
                RelativePath=".\fister.h"
                ]

            [/File]

            [File
                RelativePath=".\MainFrm.h"
                ]

            [/File]

            [File
                RelativePath=".\Mot.h"
                ]

            [/File]

            [File
                RelativePath=".\Pipe.h"
                ]

            [/File]

            [File
                RelativePath=".\PtrFifo.h"
                ]

            [/File]

            [File
                RelativePath=".\Reco.h"
                ]

            [/File]

            [File
                RelativePath=".\Resource.h"
                ]

            [/File]

            [File
                RelativePath=".\SoundBase.h"
                ]

            [/File]

            [File
                RelativePath=".\SoundFile.h"
                ]

            [/File]

            [File
                RelativePath=".\SoundIn.h"
                ]

            [/File]

            [File
                RelativePath=".\SoundOut.h"
                ]

            [/File]

            [File
                RelativePath=".\stdafx.h"
                ]

            [/File]

            [File
                RelativePath=".\targetver.h"
                ]

            [/File]

            [File
                RelativePath=".\ttsmfc.h"
                ]

            [/File]

            [File
                RelativePath=".\ttsmfcDoc.h"
                ]

            [/File]

            [File
                RelativePath=".\ttsmfcView.h"
                ]

            [/File]

            [File
                RelativePath=".\type.h"
                ]

            [/File]

            [File
                RelativePath=".\vegView.h"
                ]

            [/File]

        [/Filter]

        [Filter
            Name="Fichiers de ressources"
            Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
            UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
            ]

            [File
                RelativePath=".\res\Toolbar.bmp"
                ]

            [/File]

            [File
                RelativePath=".\res\ttsmfc.ico"
                ]

            [/File]

            [File
                RelativePath=".\ttsmfc.rc"
                ]

            [/File]

            [File
                RelativePath=".\res\ttsmfc.rc2"
                ]

            [/File]

            [File
                RelativePath=".\res\ttsmfcDoc.ico"
                ]

            [/File]

        [/Filter]

        [File
            RelativePath=".\ReadMe.txt"
            ]

        [/File]

    [/Files]

    [Globals]

        [Global
            Name="RESOURCE_FILE"
            Value="ttsmfc.rc"
        /]

    [/Globals]

[/VisualStudioProject]

Upvotes: 0

pb2q
pb2q

Reputation: 59637

$(OutDir) is a Visual Studio Build Property Macro.

You can see the values of macros using the Macros >> button in many Properties dialogs.

For instance, in Properties->General->Output Directory, click the dropdown in the value text box, choose Edit..., and in the resulting dialog, click the Macros >> button. This will give you a list of all the macros and their current values.

$(OutputDir) should be set to the output directory for the current configuration, e.g. $(SolutionDir)/$(Configuration)\.

Note that your Windows environment variables are imported as Build Property macros in your project, so in the marco list you'll see, e.g. $(Path), $(HOME), $(TEMP).

Upvotes: 28

Daniel A. White
Daniel A. White

Reputation: 190986

Those are MSBuild properties. They can be user defined or environment variables.

Upvotes: 1

Related Questions