locked
Illegal Characters in Path RRS feed

  • Question

  • Hi i am facing issue in copying files from one destination to another.

    TFSBuild.proj looks like this

    <Target Name="AfterCompile">

    <Exec Command="&quot;c:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv&quot; &quot;c:\projects\cp\CP1.1 SP1\BVT_100506\Sources\Release 1.1 Sp1\Source\Assemblies\MS.CP.ServerSolution\MS.CP.1.0.ServerSolution\MS.CP.1.0.ServerSolution.sln&quot; /Build &quot;Debug|Mixed Platforms&quot; /Project MS.CP.WebService\MS.CP.WebService.vdproj"/>

    <Copy SourceFiles="&quot;c:\projects\cp\Debug\MSCPWebService.msi&quot;"

    DestinationFolder="&quot;$(OutDir)&quot;" />

    <Copy SourceFiles="&quot;c:\projects\cp\Debug\setup.exe&quot;"

    DestinationFolder="&quot;$(OutDir)&quot;" />

    </Target>

     

    Setup gets generated successfully but it fails during in copying.

    c:\projects\cp\CP1.1 SP1\BVT_100506\BuildType\TFSBuild.proj(153,5): error MSB3021: Unable to copy file ""c:\projects\cp\Debug\MSCPWebService.msi"" to ""c:\projects\cp\CP1.1 SP1\BVT_100506\Binaries\Mixed Platforms\Debug\"". Illegal characters in path.

    Done building target "AfterCompile" in project "TFSBuild.proj" -- FAILED.

    Done building project "TFSBuild.proj" -- FAILED.

    I have tried several options like using without &quot; but it still fails.

    Please help am not able to resolve this.

    Thanks,

    Jignesh Vyas

    Thursday, October 12, 2006 2:47 AM

Answers

  • This shouldn't matter - the Copy task does not assume that the file or folder paths have no whitespaces.  The following should work just fine, for example:

    <Copy SourceFiles="C:\foo bar.txt" DestinationFolder="C:\Program Files" />

    Note the whitespace in both the filename and the destination folder. 

    So - if you are getting an error message without the double quotes, it is NOT because you need double quotes, and must be some other issue.  I'm not sure what the issue would be, however - I just tried the following MSBuild project file and it worked without issue:

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <Target Name="Build">
            <Copy SourceFiles="c:\projects\cp\CP1.1 SP1\BVT_100506\Sources\Release 1.1 Sp1\Source\Assemblies\MS.CP.ServerSolution\MS.CP.1.0.ServerSolution\MS.CP.WebService\Debug\MSCPWebService.msi" DestinationFolder="C:\foo bar" />
        </Target>
    </Project>
                                                                                                                                                                             
    -Aaron

     

    Thursday, October 12, 2006 7:08 PM
    Moderator

All replies

  • You should be fine without the quotes in the Copy task.  Try:

    <Copy SourceFiles="c:\projects\cp\Debug\MSCPWebService.msi" DestinationFolder="$(OutDir)" />

    <Copy SourceFiles="c:\projects\cp\Debug\setup.exe" DestinationFolder="$(OutDir)" />

    I think the illegal characters it is complaining about are just the quotes themselves... 

    -Aaron

    Thursday, October 12, 2006 2:22 PM
    Moderator
  • Hi i have already tried that, my $(outdir) resolves to path having spaces in it. so i had put quotes around it. Actual source folder were my msi resides is:

    $(SolutionRoot)\Assemblies\MS.CP.ServerSolution\MS.CP.1.0.ServerSolution\MS.CP.WebService\Debug\MSCPWebService.msi, which transaltes to

    c:\projects\cp\CP1.1 SP1\BVT_100506\Sources\Release 1.1 Sp1\Source\Assemblies\MS.CP.ServerSolution\MS.CP.1.0.ServerSolution\MS.CP.WebService\Debug\MSCPWebService.msi

    my actual code looked like this

    <Copy SourceFiles="&quot;$(SolutionRoot)\Assemblies\MS.CP.ServerSolution\MS.CP.1.0.ServerSolution\MS.CP.WebService\Debug\MSCPWebService.msi&quot;" DestinationFolder="&quot;$(OutDir)&quot;" />

    I had tried hardcoding path then using / not using &quot; but it does not work. when not sorrunded by double quote error message shown is unable to reolve parth of path.

     

     

     

    Thursday, October 12, 2006 6:04 PM
  • This shouldn't matter - the Copy task does not assume that the file or folder paths have no whitespaces.  The following should work just fine, for example:

    <Copy SourceFiles="C:\foo bar.txt" DestinationFolder="C:\Program Files" />

    Note the whitespace in both the filename and the destination folder. 

    So - if you are getting an error message without the double quotes, it is NOT because you need double quotes, and must be some other issue.  I'm not sure what the issue would be, however - I just tried the following MSBuild project file and it worked without issue:

    <?xml version="1.0" encoding="utf-8"?>
    <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
        <Target Name="Build">
            <Copy SourceFiles="c:\projects\cp\CP1.1 SP1\BVT_100506\Sources\Release 1.1 Sp1\Source\Assemblies\MS.CP.ServerSolution\MS.CP.1.0.ServerSolution\MS.CP.WebService\Debug\MSCPWebService.msi" DestinationFolder="C:\foo bar" />
        </Target>
    </Project>
                                                                                                                                                                             
    -Aaron

     

    Thursday, October 12, 2006 7:08 PM
    Moderator
  • Hey i got it solved...

    there were other issues as well of path incorrect. i got it solved while posting reply to this .. lol.my mistake

    its true &quot; is not require for path having spaces..

     

    Thanks a lot,

    Jignesh Vyas

    Thursday, October 12, 2006 7:42 PM