none
Unable to copy file "obj\Debug\..\APP_NAME\PAGENAME.xaml"

    Question

  • Hi there

    I have a generic Windows METRO style app that is supposed to be a base application for derived applications (with different styles, resources, etc...)

    So in order to use this generic app, I've added an other app in my solution where almost all files are links to files from my generic app, including pages.

    But when I try to compile the derived, I get the following error: "Unable to copy file "obj\Debug\..\GENERIC_APP_NAME\PAGENAME.xaml"

    I guess this has something to do with msbuild tool that doesn't copy the linked files to the right place.

    Is there a way to solve this issue?

    Thanks guys.

    Tuesday, July 17, 2012 7:40 AM

Answers

  • Hello,

    to make sure that this is equivalent to another issue is the full error message something like:

    C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v11.0\Microsoft.Windows.UI.Xaml.Common.targets(223,9): error MSB3030: Could not copy the file "obj\Debug\..\GENERIC_APP_NAME\PAGENAME.xaml" because it was not found.?

    If so, this sounds like an issue that has been resolved in post-RC builds.  The bug is related to the <Link> references in the project file.

    thanks!

    mike

    • Marked as answer by voschielle Wednesday, July 18, 2012 9:52 AM
    Tuesday, July 17, 2012 8:57 PM
  • I had the same problem. For me the following msbuild in the project file (csproj) helped because I have a lot of linked xaml-files in different folders of my project.
    It copies the linked files into the project and replaces the Page-Item with the copied items (workaround until the issue is fixed).

    <Project .... <PropertyGroup> <!-- For WPF projects --> <MarkupCompilePass1DependsOn> $(MarkupCompilePass1DependsOn) PreprocessXaml; </MarkupCompilePass1DependsOn> <!-- For Silverlight projects --> <CompileXamlDependsOn> $(CompileXamlDependsOn) PreprocessXaml; </CompileXamlDependsOn> </PropertyGroup> <Target Name="PreprocessXaml"> <CreateItem Include="@(Page)" Condition="'%(Page.Link)'!=''"> <Output TaskParameter="Include" ItemName="LinkedPages" /> </CreateItem> <CreateItem Include="@(Page)" Condition="'%(Page.Link)'==''"> <Output TaskParameter="Include" ItemName="UnlinkedPages" /> </CreateItem> <Copy SourceFiles="@(LinkedPages->'%(FullPath)')" DestinationFiles="@(LinkedPages->'%(Link)')" /> <ItemGroup> <FinalLinkedPages Include="@(LinkedPages->'%(Link)')" /> </ItemGroup> <ItemGroup> <!-- clear the list of pages and update with the new items --> <Page Remove="@(Page)" /> <Page Include="@(FinalLinkedPages);@(UnlinkedPages)" /> </ItemGroup> </Target>
    </Project>

    Hope it helps.

    Kind regards,

    Torsten

    • Marked as answer by voschielle Tuesday, July 24, 2012 2:33 PM
    Tuesday, July 24, 2012 4:11 AM
  • Well guys, that thing is fixed in the RTM version of the tools!

    \o/

    • Marked as answer by voschielle Tuesday, September 04, 2012 12:58 PM
    Tuesday, September 04, 2012 12:58 PM

All replies

  • Hello,

    to make sure that this is equivalent to another issue is the full error message something like:

    C:\Program Files (x86)\MSBuild\Microsoft\WindowsXaml\v11.0\Microsoft.Windows.UI.Xaml.Common.targets(223,9): error MSB3030: Could not copy the file "obj\Debug\..\GENERIC_APP_NAME\PAGENAME.xaml" because it was not found.?

    If so, this sounds like an issue that has been resolved in post-RC builds.  The bug is related to the <Link> references in the project file.

    thanks!

    mike

    • Marked as answer by voschielle Wednesday, July 18, 2012 9:52 AM
    Tuesday, July 17, 2012 8:57 PM
  • Hi Mike

    Thanks for the reply.

    Yeah this is the full message. And yes, this is all about <Link> files.

    So have you released a fix in july updates or do you plan to?

    Or is there any workaround?

    This bug is critical for me, if I want my app on the store for Windows 8 RTM.

    Thanks.


    • Edited by voschielle Wednesday, July 18, 2012 8:14 AM
    Wednesday, July 18, 2012 8:11 AM
  • Hello,

    I checked the latest update of VS 2012 installed from the July Update but the changes to fix the bug didn't make it in yet.  If the changes made were localized just to the targets file then it might be easy to workaround but the changes were made to some internal source tasks used by the Xaml.Common.targets file.  I can't think of a convenient workaround with VS 2012 RC (July Update) other than to avoid linked files which I understand is not that feasible.  I'll need to check when the branches with the fix will get merged with the update branch.

    thanks!

    mike

    Wednesday, July 18, 2012 8:47 PM
  • Hi Mike.  Thank you for looking into this.  I am also affected by this issue.  Any kind of work-around is greatly appreciated.  Do you know if it is possible to revert to a previous version of VS11 as a solution?
    Thursday, July 19, 2012 3:13 AM
  • Ok Mike thanks.

    So keep us posted!

    Thursday, July 19, 2012 6:53 AM
  • I had the same problem. For me the following msbuild in the project file (csproj) helped because I have a lot of linked xaml-files in different folders of my project.
    It copies the linked files into the project and replaces the Page-Item with the copied items (workaround until the issue is fixed).

    <Project .... <PropertyGroup> <!-- For WPF projects --> <MarkupCompilePass1DependsOn> $(MarkupCompilePass1DependsOn) PreprocessXaml; </MarkupCompilePass1DependsOn> <!-- For Silverlight projects --> <CompileXamlDependsOn> $(CompileXamlDependsOn) PreprocessXaml; </CompileXamlDependsOn> </PropertyGroup> <Target Name="PreprocessXaml"> <CreateItem Include="@(Page)" Condition="'%(Page.Link)'!=''"> <Output TaskParameter="Include" ItemName="LinkedPages" /> </CreateItem> <CreateItem Include="@(Page)" Condition="'%(Page.Link)'==''"> <Output TaskParameter="Include" ItemName="UnlinkedPages" /> </CreateItem> <Copy SourceFiles="@(LinkedPages->'%(FullPath)')" DestinationFiles="@(LinkedPages->'%(Link)')" /> <ItemGroup> <FinalLinkedPages Include="@(LinkedPages->'%(Link)')" /> </ItemGroup> <ItemGroup> <!-- clear the list of pages and update with the new items --> <Page Remove="@(Page)" /> <Page Include="@(FinalLinkedPages);@(UnlinkedPages)" /> </ItemGroup> </Target>
    </Project>

    Hope it helps.

    Kind regards,

    Torsten

    • Marked as answer by voschielle Tuesday, July 24, 2012 2:33 PM
    Tuesday, July 24, 2012 4:11 AM
  • Well Torsten, your workaround is working pretty well (with MarkupCompilePass2DependsOn).

    Thks a lot.

    Nevertheless, waiting for the bug fix.

    Tuesday, July 24, 2012 2:35 PM
  • Hi Torsten. Thank you for your work around.  I am able to compile my Windows 8 project now.  I am uncertain about whether there is a potential issue caused by the workaround.  Some of my linked user controls fail to render with the exception "XAML parsing failed" (with no further details) for what seems like straight-forward XAML.  I think it is possible this error is unrelated but I am sharing just in case.

    A follow-up to my original post.  The XAML errors were unrelated.  However, I do get link errors with filename.cs.g files on first compilation and the designer goes crazy trying to show externally linked user controls.  This approach creates shadow copies of the XAML files.  It isn't 100% perfect but it works and I'm thankful for a work around.  Thank you Torsten.

    • Edited by S Tonstad Wednesday, July 25, 2012 3:00 PM
    Wednesday, July 25, 2012 11:25 AM
  • Well guys, that thing is fixed in the RTM version of the tools!

    \o/

    • Marked as answer by voschielle Tuesday, September 04, 2012 12:58 PM
    Tuesday, September 04, 2012 12:58 PM
  • Yes, thank goodness.  That was a bad bug.  I get occasional lock-ups in the designer.  I hope the VS telemetry is analyzed for fixes in a future service pack.
    Wednesday, September 05, 2012 9:11 PM