locked
Copy File Error RRS feed

  • Question

  • User1838741531 posted

    Hello,

    I'm having a problem while copying my output files, i'm using this:

      <Target Name= "AfterBuild" >
       < Copy SourceFiles= "$(OutputPath)*.ascx" DestinationFolder="..\MYFOLDER" />
      < /Target >


    But i'm receiving this:
       Unable to copy file "MYOUTPUTFOLDER\*.ascx" to "..\MYFOLDER\*.ascx". Illegal characters in path.

    I don't understand what i'm doing wrong.

    Can anyone help me with this?

    Thanks

    Tuesday, January 8, 2008 11:39 AM

Answers

  • User1838741531 posted

    Ok, I found a solution:

     I create an ItemGroup first, where I specify the files to be copied, then I use that ItemGroup in the copy statement:

    1      <ItemGroup>
    2      <MyFiles Include="MYOUTPUTFOLDER\*.ascx; MYOUTPUTFOLDER\*.aspx"/>
    3      </ItemGroup>
    4   
    5      <Target Name="AfterBuild">
    6      <Copy SourceFiles="@(MyFiles)" DestinationFolder="..\MYFOLDER" />
    7    </Target>

    It's working. I'm assuming that it wasn't working because of what utlandsfantomenno1 said, and had nothing to do with Illegal characters

     Thanks a lot, anyway.

     PS: http://msdn.microsoft.com/en-us/library/646dk05y(VS.80).aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 8, 2008 12:52 PM

All replies

  • User-955326108 posted

    I'm guessing the star in "MYOUTPUTFOLDER\*.ascx" is interpreted as a filename and not the way you wan't it interpreted, as a wildcard character.

    I'm further guessing you'd have to loop through all files and then copy them, on a per name basis.

    Cheers!

    /Eskil

    Tuesday, January 8, 2008 12:29 PM
  • User1838741531 posted

    That's an ideia, but i hope the last i'll try.[:S]

     I have too many files, for it to be a maintainable solution.

     Thanks any way [;)]

    Tuesday, January 8, 2008 12:33 PM
  • User1838741531 posted

    Ok, I found a solution:

     I create an ItemGroup first, where I specify the files to be copied, then I use that ItemGroup in the copy statement:

    1      <ItemGroup>
    2      <MyFiles Include="MYOUTPUTFOLDER\*.ascx; MYOUTPUTFOLDER\*.aspx"/>
    3      </ItemGroup>
    4   
    5      <Target Name="AfterBuild">
    6      <Copy SourceFiles="@(MyFiles)" DestinationFolder="..\MYFOLDER" />
    7    </Target>

    It's working. I'm assuming that it wasn't working because of what utlandsfantomenno1 said, and had nothing to do with Illegal characters

     Thanks a lot, anyway.

     PS: http://msdn.microsoft.com/en-us/library/646dk05y(VS.80).aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 8, 2008 12:52 PM