# Error creating layout - trying to copy file to itself

### Question

• In a C++ project, the layout creation fails because it is trying to copy a file to itself.  A Custom Build Step takes a strings.resx file and creates a strings.xus in the intermediate directory.  Note we added bin and obj to the default OutDir and IntDir directories to separate those files and not pollute the solution directory with directories named after the configurations.

OutDir=$(SolutionDir)bin\$(Configuration)\

IntDir=obj\$(Configuration)\ 6>Error DEP1000 : Cannot copy file "D:\Projects\zzz\Branches\EdMetro\Private\Games\zzz\obj\Debug\UI\en-us\text\strings.xus" to layout "D:\Projects\zzz\Branches\EdMetro\Private\Games\zzz\obj\Debug\UI\en-us\text\strings.xus" for the following reason: 6>The process cannot access the file 'D:\Projects\zzz\Branches\EdMetro\Private\Games\zzz\obj\Debug\UI\en-us\text\strings.xus' because it is being used by another process. What determines where the layout is created and why is it trying to copy the file to itself? This is a blocker on our current project as it means we cannot deploy and debug. Wednesday, February 15, 2012 2:37 AM ### Answers • Ahh, yes. That does appear to be the case. Output files from the Custom Build Steps must be placed in the$(ProjectDir) in the directory structure they are expected to be in the final package.  Otherwise bad things happen (fully qualified file names in layout.resfiles which breaks layout creation, $(IntDir) appearing in the appx package, etc). Wednesday, February 15, 2012 5:46 AM ### All replies • I discovered in layout.resfiles, which appears to be a list of files that go into the package, that the file in question has a fully-qualified filename, rather than relative filenames for the other files. I thought maybe because I had$(SolutionDir)$(IntDir) in the Output Path for the Custom Build Step, but changing that to$(IntDir) still resulted in the fully-qualified filename in layout.resfiles.

Also, it looks like we must have all content files relative to the $(ProjectDir) rather than processed from the source data into$(IntDir) in order to get the correct directory structure in the appx.  Is that correct?  My project dir is going to be littered with intermediate and output files if that is the case.

Wednesday, February 15, 2012 5:28 AM
• Ahh, yes.  That does appear to be the case.  Output files from the Custom Build Steps must be placed in the $(ProjectDir) in the directory structure they are expected to be in the final package. Otherwise bad things happen (fully qualified file names in layout.resfiles which breaks layout creation,$(IntDir) appearing in the appx package, etc).

Wednesday, February 15, 2012 5:46 AM