Forum Visual Studio
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

VS 2017 starts erroring on UWP project with could not copy the file \obj\debug\<.xbf> not found

rlounsburyrlounsbury Member ✭✭

I have a UWP application that I have been making changes to over the last several days. The changes I have made are all in the back-end projects and nothing has changed in the UWP project. Suddenly though this morning when I try to build I am getting several errors in the UWP file of the format:
'Could not copy the file "obj\x86\Debut\.xbf" because it was not found''
Additionally, I am getting a message that the UWP project "cannot resolve Assembly or Windows Meta file..." and a reference to a project that the UWP project does NOT reference, but is referenced by the back-end projects. (The referenced project is a Windows Framework 4.5.2 project, but that also hasn't changed since I was able to build and run the UWP.)

I have tried:
- Cleaning and rebuilding the entire solution
- Cleaning the solution, closing VS, deleting the UWP obj folder contents, restarting VS and rebuilding
- Cleaning and rebuilding only the UWP

Due to my development management environment, I am stuck with VS 2017, so upgrading is NOT an option as a solution.

Does anyone have any suggestions for fixing this?

TIA,
Ron L

Best Answer

  • rlounsburyrlounsbury Member ✭✭
    Accepted Answer

    I finally found the cause of the problem. I have several projects in my solution:

    • .UWP
    • .Android
    • .Ios
    • .core
    • A "common" project shared with another, web app, application

    I had changed one of the classes in my .core projects to inherit from a class in the shared project rather than be a facade for it. This class was included as a collection in another class which was, in turn, consumed by some view models and bound to lists in the view. (All view models and views are defined in the project, not in the target-specific ones.) I am still not sure what the reason for the inheritance causing the error is, but removing the inheritance allows me to build and run the application again.

    The errors I was seeing were:
    Could not copy the file "obj\x86\Debug\.UWP.xr.xml" because it was not found.
    Could not copy the file "obj\x86\Debug\MainPage.xbf" because it was not found.
    Could not copy the file "obj\x86\Debug\App.xbf" because it was not found.
    Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: ,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.' .UWP ....\\.UWP
    \.UWP.csproj

Answers

  • anderson_Smauganderson_Smaug Member ✭✭

    Do you already see if the mono version in visual studio is compatible with your project?
    this may be affecting your components.

    as you are in the 2017 version of VS try to use version 5.18 of mono

  • rlounsburyrlounsbury Member ✭✭

    Anderson_Smaug,
    Thank you for taking the time to answer, but I am confused; my problem is with the UWP project compilation and not the Android version, so how I am not sure how the Mono version would matter. Additionally, the solution had compiled and run the previous day, and I had not made any changes to the UWP code (nor, I believe to the UWP references other than my projects) only to two of the back-end projects in the solution. Do you have any other suggestions?

    TIA,
    Ron L.

  • rlounsburyrlounsbury Member ✭✭

    So I found a partial solution - the xbf files (I had 2 xbf and 1 xml file missing) can be copied from elsewhere in the project as indicated in this YouTube video: I copied mine from subfolders of the project's bin folder. Unfortunately, however, I am still getting a compile error "Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: ..." referencing a project that the UWP doesn't have any direct references to. (The main and .Core projects that the UWP references do have references to this project, but the UWP does not.)

  • rlounsburyrlounsbury Member ✭✭
    Accepted Answer

    I finally found the cause of the problem. I have several projects in my solution:

    • .UWP
    • .Android
    • .Ios
    • .core
    • A "common" project shared with another, web app, application

    I had changed one of the classes in my .core projects to inherit from a class in the shared project rather than be a facade for it. This class was included as a collection in another class which was, in turn, consumed by some view models and bound to lists in the view. (All view models and views are defined in the project, not in the target-specific ones.) I am still not sure what the reason for the inheritance causing the error is, but removing the inheritance allows me to build and run the application again.

    The errors I was seeing were:
    Could not copy the file "obj\x86\Debug\.UWP.xr.xml" because it was not found.
    Could not copy the file "obj\x86\Debug\MainPage.xbf" because it was not found.
    Could not copy the file "obj\x86\Debug\App.xbf" because it was not found.
    Cannot resolve Assembly or Windows Metadata file 'Type universe cannot resolve assembly: ,
    Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.' .UWP ....\\.UWP
    \.UWP.csproj

Sign In or Register to comment.