I keep getting XamlFilePathAttribute class not found error when modifying Xaml files

This attribute was introduced in November. Somehow it get's injected in my generated cs files for my xaml views but the compiler has no clue where to find the attribute. I suppose I have a versioning problem. Is it possible to get the versions where this was introduced in tools and in the libraries please?

Best Answer

  • SylvainGravelSylvainGravel CA ✭✭
    Accepted Answer

    What I do is that I simply remove the line from the generated .cs file for the view

Answers

  • SylvainGravelSylvainGravel CAMember ✭✭

    Could it be due to this line in my AssemblyInfo.cs? I didn't have that before...

    [assembly: XamlCompilation(XamlCompilationOptions.Compile)]

  • JonathanSosaJonathanSosa JPMember

    Getting the same issue. Did you resolve it?

  • CuckooshkaCuckooshka USMember ✭✭

    The same for me. I'm working with Xamarin.Forms. I've just updated all to the latest versions (Android SDK, all founded by Xamarin Studio updates , all packages in solution) and now I can't build the project.

  • alexgealexge FRMember

    @Cuckooshka thank you it works

  • RonFreschiRonFreschi USUniversity ✭✭

    Cleaning of bin and obj did not work.

    Error CS0234: The type or namespace name XamlFilePathAttribute' does not exist in the namespace Xamarin.Forms.Xaml'. Are you missing an assembly reference?

  • Manikandan_SManikandan_S USMember ✭✭

    @Cuckooshka said:
    Ok, here is what I did to fix it.

    • Cleanup solution
    • Close Xamarin Studio
    • Remove all .bin and .obj folders in all projects.
    • Open Xamarin Studio and rebuild the solution.

    I think the key is to remove .bin and .obj folders and rebuild the solution, because the generated .g.cs files are located somewhere in that folders, and they keep referencing on something inappropriate.
    After removal they will be regenerated without the error.

    For Xamarin studio we can use this fix.
    But im working on Jenkins automated build system. Every time i'm getting this error during release build.
    Any other solution for this?

  • LucaPisanoLucaPisano ITMember ✭✭

    Update Xamarin.Forms to version 2.3.4.192-pre2 from nuget. It solves the issue

  • nogardnogard MXMember

    With VStudio you need click in Solution Clean after Click in Compile Solution.

    con visual studio es necesario limpiar el proyecto y despues compilar desde la misma solucion, no necesite regresar la version.

    saludos

  • SylvainGravelSylvainGravel CAMember ✭✭
    Accepted Answer

    What I do is that I simply remove the line from the generated .cs file for the view

  • Hi SylvainGravel,

    Removing the line worked for me.

    Thanks,
    Akash

  • BalakrishnanSBalakrishnanS USMember ✭✭

    Remove all .bin and .obj folders in Portable project and Try.

    It works for me.

    Thanks

  • RodAppableRodAppable AUMember ✭✭

    Removing bin's and obj's, clean and build does not work for me. Removing the line from the xaml.g.cs works but I have 148 of these errors and I clean and rebuild they get generated again. Impractical. Has anyone got a permanent solution?

  • SylvainGravelSylvainGravel CAMember ✭✭

    Update your Forms version, it should be fixed by now

  • PiyushpatilPiyushpatil INMember

    The type or namespace name XamlFilePathAttribute' does not exist in the namespace Xamarin.Forms.Xaml'. Are you missing an assembly reference?

  • RenaudLaloireRenaudLaloire BEUniversity ✭✭

    Update all projects version of Xamarin Forms with the same version resolve this issue.

  • razishrazish DEMember ✭✭

    @Cuckooshka said:
    Ok, here is what I did to fix it.

    • Cleanup solution
    • Close Xamarin Studio
    • Remove all .bin and .obj folders in all projects.
    • Open Xamarin Studio and rebuild the solution.

    I think the key is to remove .bin and .obj folders and rebuild the solution, because the generated .g.cs files are located somewhere in that folders, and they keep referencing on something inappropriate.
    After removal they will be regenerated without the error.

    Thanks, It worked.

  • RoyMRoyM USMember

    Clean .obj and .bin folder. Restart VS in Admin mode and Build.

  • NimralNimral Member ✭✭

    For me, this worked (VS 2017)

    • remove all obj and .bin directories
    • start VS as admin
    • load solution and "build" - "clean" it
    • rebuild all

    Not sure whether all those steps were requred. Fact is, now it works. Note: the probem does usually occur if I load sample projects from Github and try to compile them for the first time. Maybe a version clash if my Xamarin version differs from the original author's?

Sign In or Register to comment.