locked
Project : warning PRJ0018: The following environment variables were not found: $(MSBuildProjectDirectory) RRS feed

  • Question

  • I need to use the environment variable MSBuildProjectDirectory in my vcproj.  I've run it from the command line and verified that it is defined and correct.  But the build keeps telling me it is not defined and it is blank when looking at the build log.

    Why is this not working?

    Wednesday, May 5, 2010 2:59 PM

Answers

  • Hi Megabitte,

    Thanks for your post.

    This issue is possibly caused by lacking '\' behind $(MSBuildProjectDirectory), please refer to following sentence:

    AdditionalLibraryDirectories="$(MSBuildProjectDirectory)\
    ..\..\..\Installations\WiX\Windows Installer XML v3\sdk\lib"

    For more information, please see thread below:

    $(MSBuildProjectDirectory)

    http://social.msdn.microsoft.com/Forums/en/msbuild/thread/d9becd34-419f-40d7-8449-c9940694c4bd

    If you have any comments, please feel free to let me know.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by megabitee Thursday, May 6, 2010 1:09 PM
    Thursday, May 6, 2010 10:33 AM

All replies

  • Hi

    MSBuildProjectDirectory is a reserved property, rather than Environment variable. you should have access to it though. Can you post a failing sample.

     

    Mike


    Visual Studio ALM MVP
    My Blog | MSBuild Extension Pack | MSBuild Explorer
    Wednesday, May 5, 2010 3:22 PM
  • <?xml version="1.0" encoding="Windows-1252"?>
    <VisualStudioProject
     ProjectType="Visual C++"
     Version="9.00"
     Name="CustomAction.MergeModule.OphirFastX"
     ProjectGUID="{2FAAFC55-6DA0-4B69-B79D-02AA9230CB15}"
     RootNamespace="CustomAction.MergeModule.OphirFastX"
     SccProjectName="SAK"
     SccAuxPath="SAK"
     SccLocalPath="SAK"
     SccProvider="SAK"
     Keyword="Win32Proj"
     TargetFrameworkVersion="0"
     >
     <Platforms>
      <Platform
       Name="Win32"
      />
     </Platforms>
     <ToolFiles>
     </ToolFiles>
     <Configurations>
      <Configuration
       Name="Debug|Win32"
       OutputDirectory="bin\$(ConfigurationName)"
       IntermediateDirectory="obj\$(ConfigurationName)"
       ConfigurationType="2"
       CharacterSet="1"
       ManagedExtensions="0"
       >
       <Tool
        Name="VCPreBuildEventTool"
       />
       <Tool
        Name="VCCustomBuildTool"
       />
       <Tool
        Name="VCXMLDataGeneratorTool"
       />
       <Tool
        Name="VCWebServiceProxyGeneratorTool"
       />
       <Tool
        Name="VCMIDLTool"
       />
       <Tool
        Name="VCCLCompilerTool"
        Optimization="0"
        AdditionalIncludeDirectories="$(MSBuildProjectFullPath)..\..\..\Installations\WiX\Windows Installer XML v3\sdk\inc"
        PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;CUSTOMACTIONTEST_EXPORTS"
        MinimalRebuild="false"
        BasicRuntimeChecks="0"
        RuntimeLibrary="1"
        UsePrecompiledHeader="2"
        WarningLevel="3"
        DebugInformationFormat="3"
       />
       <Tool
        Name="VCManagedResourceCompilerTool"
       />
       <Tool
        Name="VCResourceCompilerTool"
       />
       <Tool
        Name="VCPreLinkEventTool"
       />
       <Tool
        Name="VCLinkerTool"
        AdditionalDependencies="msi.lib dutil.lib wcautil.lib"
        LinkIncremental="2"
        AdditionalLibraryDirectories="$(MSBuildProjectFullPath)..\..\..\Installations\WiX\Windows Installer XML v3\sdk\lib"
        ModuleDefinitionFile="CustomAction.def"
        GenerateDebugInformation="true"
        AssemblyDebug="1"
        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="bin\$(ConfigurationName)"
       IntermediateDirectory="obj\$(ConfigurationName)"
       ConfigurationType="2"
       CharacterSet="1"
       WholeProgramOptimization="1"
       >
       <Tool
        Name="VCPreBuildEventTool"
       />
       <Tool
        Name="VCCustomBuildTool"
       />
       <Tool
        Name="VCXMLDataGeneratorTool"
       />
       <Tool
        Name="VCWebServiceProxyGeneratorTool"
       />
       <Tool
        Name="VCMIDLTool"
       />
       <Tool
        Name="VCCLCompilerTool"
        Optimization="2"
        EnableIntrinsicFunctions="true"
        AdditionalIncludeDirectories="$(MSBuildProjectDirectory)..\..\..\Installations\WiX\Windows Installer XML v3\sdk\inc"
        PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;CUSTOMACTIONTEST_EXPORTS"
        RuntimeLibrary="0"
        EnableFunctionLevelLinking="true"
        UsePrecompiledHeader="2"
        WarningLevel="3"
        DebugInformationFormat="3"
       />
       <Tool
        Name="VCManagedResourceCompilerTool"
       />
       <Tool
        Name="VCResourceCompilerTool"
       />
       <Tool
        Name="VCPreLinkEventTool"
       />
       <Tool
        Name="VCLinkerTool"
        AdditionalDependencies="msi.lib dutil.lib wcautil.lib"
        LinkIncremental="1"
        AdditionalLibraryDirectories="$(MSBuildProjectDirectory)..\..\..\Installations\WiX\Windows Installer XML v3\sdk\lib"
        ModuleDefinitionFile="CustomAction.def"
        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="Source Files"
       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
       >
       <File
        RelativePath=".\CustomAction.cpp"
        >
       </File>
       <File
        RelativePath=".\CustomAction.def"
        >
       </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>
      </Filter>
      <Filter
       Name="Header Files"
       Filter="h;hpp;hxx;hm;inl;inc;xsd"
       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
       >
       <File
        RelativePath=".\stdafx.h"
        >
       </File>
       <File
        RelativePath=".\targetver.h"
        >
       </File>
      </Filter>
      <Filter
       Name="Resource Files"
       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}"
       >
      </Filter>
     </Files>
     <Globals>
     </Globals>
    </VisualStudioProject>

    Wednesday, May 5, 2010 4:08 PM
  • Hi Megabitte,

    Thanks for your post.

    This issue is possibly caused by lacking '\' behind $(MSBuildProjectDirectory), please refer to following sentence:

    AdditionalLibraryDirectories="$(MSBuildProjectDirectory)\
    ..\..\..\Installations\WiX\Windows Installer XML v3\sdk\lib"

    For more information, please see thread below:

    $(MSBuildProjectDirectory)

    http://social.msdn.microsoft.com/Forums/en/msbuild/thread/d9becd34-419f-40d7-8449-c9940694c4bd

    If you have any comments, please feel free to let me know.

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by megabitee Thursday, May 6, 2010 1:09 PM
    Thursday, May 6, 2010 10:33 AM