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

SylvainGravelSylvainGravel Sylvain GravelCAMember ✭✭

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 Sylvain Gravel CAMember ✭✭
    Accepted Answer

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

Answers

  • SylvainGravelSylvainGravel Sylvain Gravel CAMember ✭✭

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

    [assembly: XamlCompilation(XamlCompilationOptions.Compile)]

  • JonathanSosaJonathanSosa Jonathan Sosa JPMember

    Getting the same issue. Did you resolve it?

  • CuckooshkaCuckooshka Oxana Grishchenko 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 Alexandre Gerfanion FRMember

    @Cuckooshka thank you it works

  • RonFreschiRonFreschi Ron Freschi 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 Manikandan 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 Luca Pisano ITMember ✭✭

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

  • nogardnogard josef josef 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 Sylvain Gravel CAMember ✭✭
    Accepted Answer

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

  • akashjindal6264akashjindal6264 Akash Jindal INMember

    Hi SylvainGravel,

    Removing the line worked for me.

    Thanks,
    Akash

  • BalakrishnanSBalakrishnanS Balakrishnan S USMember ✭✭

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

    It works for me.

    Thanks

  • RodAppableRodAppable Rod Hemphill 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 Sylvain Gravel CAMember ✭✭

    Update your Forms version, it should be fixed by now

  • PiyushpatilPiyushpatil Piyush Patil INMember

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

  • RenaudLaloireRenaudLaloire Renaud Laloire BEUniversity ✭✭

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

Sign In or Register to comment.