Ask a questionAsk a question
 

General DiscussionVCPROJ upgrader - include path and output/temp directory creation issues

  • Tuesday, January 13, 2009 1:16 AMBob Summerwill Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I hit two issues when first using the VCPROJ upgrader:


    1. Include paths with quotes around them are "upgraded" into VCPROJX files which don't actually work!     I believe this is similar to the issues reported in the following e-mail:

    http://social.msdn.microsoft.com/Forums/en-US/vs2010ctpcpp/thread/267022c4-e155-4b96-9679-463be84f2e2b#page:9999

    This issue can be worked around by manually stripping the quotes from either the source or generated paths, but can be considered a bug in the upgrader.   It takes a valid VCPROJ, which works, and produces an MSBuild file which doesn't work.

    If you don't already have a use-case to demonstrate this issue, I can put one together.    I believe you just get an invalid cl.exe command line generated when you try to build.     Just have quotes within the generated MSBuild file around include paths to see the issue.


    2. Visual Studio building using VCPROJ generates any required output or intermediate paths implicitly as part of the build process.   That doesn't seem to be happening off-the-bat with the MSBuild C++ build system.     The failure case I hit was that the linker was trying to generate a PDB into a directory which hadn't been created yet - resulting in a build error.

    Again, I can put together a use-case if needed, but just point your PDB directory to a non-existent directory to replicate the issue.



    Cheers,
    Bob

All Replies

  • Thursday, January 22, 2009 9:08 AMMarian LuparuMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    Hello Bob,

    Thank you for trying out the conversion and sending us your feedback. We’ve run into these issues as well and have addressed them post CTP.

    1)      MSBuild does not allow the extra quotes, so during build you will get an error similar to this:

    C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(846,14): error MSB4023: Cannot evaluate the item metadata "%(RootDir)". The item metadata "%(RootDir)" cannot be applied to the path ""Debug\App.exe.intermediate.manifest"". Illegal characters in path.


    The workaround for this is unfortunately to go in the project file by hand and remove the quotes from the ofending property values.

    This issue has already been fixed in the convertor and will be available in Beta 1.

     

    2)      We also have added code (post CTP) to create the directory structure for those tools that don’t support creating one on the fly. You can find a list of all the properties for which directories will be created during build below:

    c:\Program Files\MSBuild\Microsoft.Cpp\v4.0>findstr /i /s "DirsToMake" *.targets

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(BscDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(ClDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(CustomBuildDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(GeneralDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(LinkDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(ManifestDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(MidlDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(RcDirsToMake)" />

    Microsoft.Cpp.targets:    <AllDirsToMake Include="@(XdcDirsToMake)" />

    Microsoft.CppBuild.targets:    <GeneralDirsToMake Include="$([System.IO.Path]::GetDirectoryName('$(B

    uildLogFile)'))" />

    Microsoft.CppBuild.targets:    <GeneralDirsToMake Include="$(IntDir)" />

    Microsoft.CppBuild.targets:    <GeneralDirsToMake Include="$(OutDir)" />

    Microsoft.CppBuild.targets:     <MakeDir Directories="@(GeneralDirsToMake);$(TargetDir)"/>

    Microsoft.CppBuild.targets:    <MidlDirsToMake Include="@(Midl->'%(OutputDirectory)')" />

    Microsoft.CppBuild.targets:    <MidlDirsToMake Include="@(Midl->'%(DllDataFileName)')" />

    Microsoft.CppBuild.targets:    <MidlDirsToMake Include="@(Midl->'%(TypeLibraryName)')" />

    Microsoft.CppBuild.targets:    <MidlDirsToMake Include="@(Midl->'%(ProxyFileName)')" />

    Microsoft.CppBuild.targets:    <MidlDirsToMake Include="@(Midl->'%(InterfaceIdentifierFileName)')" /

    Microsoft.CppBuild.targets:    <MakeDir Directories="@(MidlDirsToMake->'%(RootDir)%(Directory)')" />

     

    Microsoft.CppBuild.targets:   <RcDirsToMake Include="@(ResourceCompile->'%(ResourceOutputFileName)')

    " />

    Microsoft.CppBuild.targets:    <MakeDir Directories="@(RcDirsToMake->'%(RootDir)%(Directory)')" />

    Microsoft.CppBuild.targets:    <ClDirsToMake Include="@(CLCompile->'%(PrecompiledHeaderOutputFile)')

    " />

    Microsoft.CppBuild.targets:    <ClDirsToMake Include="@(CLCompile->'%(AssemblerListingLocation)')" /

    Microsoft.CppBuild.targets:    <ClDirsToMake Include="@(CLCompile->'%(ObjectFileName)')" />

    Microsoft.CppBuild.targets:    <ClDirsToMake Include="@(CLCompile->'%(ProgramDataBaseFileName)')" />

     

    Microsoft.CppBuild.targets:    <ClDirsToMake Include="@(CLCompile->'%(XMLDocumentationFileName)')" /

    Microsoft.CppBuild.targets:    <ClDirsToMake Include="@(CLCompile->'%(BrowseInformationFile)')" />

    Microsoft.CppBuild.targets:    <MakeDir Directories="@(ClDirsToMake->'%(RootDir)%(Directory)')" />

    Microsoft.CppBuild.targets:      <CustomBuildDirsToMake Include="$(CustomBuildOutputs)" Condition="'

    $(CustomBuildCommand)' != ''"/>

    Microsoft.CppBuild.targets:      <CustomBuildDirsToMake Include="%(CustomBuild.Outputs)" Condition="

    '@(CustomBuild)' != ''"/>

    Microsoft.CppBuild.targets:      <Link Include="%(CustomBuildDirsToMake.Identity)" Condition="'%(Ext

    ension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'"/>

    Microsoft.CppBuild.targets:      <Lib Include="%(CustomBuildDirsToMake.Identity)" Condition="'%(Exte

    nsion)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'"/>

    Microsoft.CppBuild.targets:      <ImpLib Include="%(CustomBuildDirsToMake.Identity)" Condition="'%(E

    xtension)'=='.obj' or '%(Extension)'=='.res' or '%(Extension)'=='.rsc' or '%(Extension)'=='.lib'"/>

    Microsoft.CppBuild.targets:    <MakeDir Directories="@(CustomBuildDirsToMake->'%(RootDir)%(Directory

    )')" />

    Microsoft.CppBuild.targets:      <LinkDirsToMake Include="@(Link->'%(MapFileName)')" />

    Microsoft.CppBuild.targets:      <LinkDirsToMake Include="@(Link->'%(OutputFile)')" />

    Microsoft.CppBuild.targets:      <LinkDirsToMake Include="@(Link->'%(ManifestFile)')" />

    Microsoft.CppBuild.targets:      <LinkDirsToMake Include="@(Link->'%(ProgramDatabaseFile)')" />

    Microsoft.CppBuild.targets:      <LinkDirsToMake Include="$(_LinkImportLibraryDir)" />

    Microsoft.CppBuild.targets:    <MakeDir Directories="@(LinkDirsToMake->'%(RootDir)%(Directory)')" />

     

    Microsoft.CppBuild.targets:      <XdcDirsToMake Include="@(XdcMake->'%(OutputFile)')" />

    Microsoft.CppBuild.targets:    <MakeDir Directories="@(XdcDirsToMake->'%(RootDir)%(Directory)')" />

    Microsoft.CppBuild.targets:      <BscDirsToMake Include="@(BscMake->'%(OutputFile)')" />

    Microsoft.CppBuild.targets:    <MakeDir Directories="@(BscDirsToMake->'%(RootDir)%(Directory)')" />

    Microsoft.CppCommon.targets:    <ManifestDirsToMake Include="@(Manifest->'%(OutputManifestFile)')" /

    Microsoft.CppCommon.targets:    <ManifestDirsToMake Include="@(Manifest->'%(OutputResourceManifests)

    ')" />

    Microsoft.CppCommon.targets:    <ManifestDirsToMake Include="@(ManifestResourceCompile->'%(ResourceO

    utputFileName)')" />

    Microsoft.CppCommon.targets:    <MakeDir Directories="@(ManifestDirsToMake->'%(RootDir)%(Directory)'

    )" />

     

    As a hack for the CTP, please create a Pre-Build Event that will have a series of mkdir calls to re-create the folder structure your project expects.

     

    Hope this helps,

    Marian Luparu

    Visual C++ IDE