Where is '$OutDir' defined in the script in Visual Studio?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Where is '$OutDir' defined in the script in Visual Studio?

  1. #1
    Join Date
    Aug 2006
    Posts
    508

    Where is '$OutDir' defined in the script in Visual Studio?

    I have combined couple of projects into one solution. These projects are converted into VS2010 from older version. The problem is that I want all the projects to spit out the exectuables/dlls into the solution's debug or release folder but this is not working.

    I go into project properites >> Configuration Properities >> General >> 'Output Directory' and change the output directory to $(SolutionDir)$(Configuration)\ but it has not effect the executable/dll are still generated at the old location.

    I created a new VS2010 project just to look at the settings and hopefully replicate that in my project. Both the .vcxproj and .sln file has not mention of the SolutionDir or anything else of that nature (like wise it doesn't have OutDir either).

    Where does Visual Studio define these? How can I change them so my project does generate output files at that folder! Thanks!

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,591

    Re: Where is '$OutDir' defined in the script in Visual Studio?

    Did you try looking into the .vcproj files?
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Aug 2006
    Posts
    508

    Re: Where is '$OutDir' defined in the script in Visual Studio?

    Quote Originally Posted by Eri523 View Post
    Did you try looking into the .vcproj files?
    Yes that's where I have been looking. Here is my .vcxproj file and there is no mention of any identifiers which set this paths in project settings.
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
      <ItemGroup Label="ProjectConfigurations">
        <ProjectConfiguration Include="Debug|Win32">
          <Configuration>Debug</Configuration>
          <Platform>Win32</Platform>
        </ProjectConfiguration>
        <ProjectConfiguration Include="Release|Win32">
          <Configuration>Release</Configuration>
          <Platform>Win32</Platform>
        </ProjectConfiguration>
      </ItemGroup>
      <PropertyGroup Label="Globals">
        <ProjectGuid>{D343214C-896D-44F6-BA3D-3E3D33A85092}</ProjectGuid>
        <RootNamespace>PasswordTest</RootNamespace>
        <Keyword>MFCProj</Keyword>
      </PropertyGroup>
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
        <ConfigurationType>Application</ConfigurationType>
        <UseDebugLibraries>true</UseDebugLibraries>
        <CharacterSet>Unicode</CharacterSet>
        <UseOfMfc>Dynamic</UseOfMfc>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
        <ConfigurationType>Application</ConfigurationType>
        <UseDebugLibraries>false</UseDebugLibraries>
        <WholeProgramOptimization>true</WholeProgramOptimization>
        <CharacterSet>Unicode</CharacterSet>
        <UseOfMfc>Dynamic</UseOfMfc>
      </PropertyGroup>
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
      <ImportGroup Label="ExtensionSettings">
      </ImportGroup>
      <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
        <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
      </ImportGroup>
      <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
        <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
      </ImportGroup>
      <PropertyGroup Label="UserMacros" />
      <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
        <LinkIncremental>true</LinkIncremental>
      </PropertyGroup>
      <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
        <LinkIncremental>false</LinkIncremental>
      </PropertyGroup>
      <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
        <ClCompile>
          <PrecompiledHeader>Use</PrecompiledHeader>
          <WarningLevel>Level3</WarningLevel>
          <Optimization>Disabled</Optimization>
          <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        </ClCompile>
        <Link>
          <SubSystem>Windows</SubSystem>
          <GenerateDebugInformation>true</GenerateDebugInformation>
        </Link>
        <Midl>
          <MkTypLibCompatible>false</MkTypLibCompatible>
          <ValidateAllParameters>true</ValidateAllParameters>
          <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        </Midl>
        <ResourceCompile>
          <Culture>0x0409</Culture>
          <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
          <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        </ResourceCompile>
      </ItemDefinitionGroup>
      <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
        <ClCompile>
          <WarningLevel>Level3</WarningLevel>
          <PrecompiledHeader>Use</PrecompiledHeader>
          <Optimization>MaxSpeed</Optimization>
          <FunctionLevelLinking>true</FunctionLevelLinking>
          <IntrinsicFunctions>true</IntrinsicFunctions>
          <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        </ClCompile>
        <Link>
          <SubSystem>Windows</SubSystem>
          <GenerateDebugInformation>true</GenerateDebugInformation>
          <EnableCOMDATFolding>true</EnableCOMDATFolding>
          <OptimizeReferences>true</OptimizeReferences>
        </Link>
        <Midl>
          <MkTypLibCompatible>false</MkTypLibCompatible>
          <ValidateAllParameters>true</ValidateAllParameters>
          <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
        </Midl>
        <ResourceCompile>
          <Culture>0x0409</Culture>
          <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
          <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
        </ResourceCompile>
      </ItemDefinitionGroup>
      <ItemGroup>
        <None Include="ReadMe.txt" />
        <None Include="res\PasswordTest.ico" />
        <None Include="res\PasswordTest.rc2" />
      </ItemGroup>
      <ItemGroup>
        <ClInclude Include="PasswordDoc.h" />
        <ClInclude Include="PasswordTest.h" />
        <ClInclude Include="PasswordTestDlg.h" />
        <ClInclude Include="Resource.h" />
        <ClInclude Include="stdafx.h" />
        <ClInclude Include="targetver.h" />
      </ItemGroup>
      <ItemGroup>
        <ClCompile Include="PasswordDoc.cpp" />
        <ClCompile Include="PasswordTest.cpp" />
        <ClCompile Include="PasswordTestDlg.cpp" />
        <ClCompile Include="stdafx.cpp">
          <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
          <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
        </ClCompile>
      </ItemGroup>
      <ItemGroup>
        <ResourceCompile Include="PasswordTest.rc" />
      </ItemGroup>
      <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
      <ImportGroup Label="ExtensionTargets">
      </ImportGroup>
      <ProjectExtensions>
        <VisualStudio>
          <UserProperties RESOURCE_FILE="PasswordTest.rc" />
        </VisualStudio>
      </ProjectExtensions>
    </Project>
    I am lost where are the configured!?

  4. #4
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,022

    Re: Where is '$OutDir' defined in the script in Visual Studio?

    Quote Originally Posted by zspirit View Post
    I go into project properites >> Configuration Properities >> General >> 'Output Directory' and change the output directory to $(SolutionDir)$(Configuration)\ but it has not effect the executable/dll are still generated at the old location.
    Output Directory is exactly $(OutDir). You have to make sure you rebuild your solution, and there's no errors in build log.
    Best regards,
    Igor

  5. #5
    Join Date
    Apr 2000
    Location
    Belgium (Europe)
    Posts
    3,966

    Re: Where is '$OutDir' defined in the script in Visual Studio?

    OutDir gets defined by default in one of the default property sheet.
    If you override the outdir in the project settings, it'll be overwritten/redefined in the vcxproj file. (between <OutDir> tags. it could be conditional for debug/release.

  6. #6
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,634

    Re: Where is '$OutDir' defined in the script in Visual Studio?

    The easiest way (as I know) of finding out the values for all MSVC $(Anything) is to:
    - Click for instance Output Directory
    - Click the Arrow and select edit
    - Click Macros to display them all
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    http://www.microsoft.com/visualstudio/eng/downloads

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center