Xamarin.forms: Errors on Build related to XamlGTask

Created on 8 Jun 2018  ·  19Comments  ·  Source: xamarin/Xamarin.Forms

When I try to build my XF project, I intermittently get two errors. If I try to rebuild over and over, they _sometimes_ go away and I'm able to build.

Visual Studio Mac 7.5.2 (Build 40)
Xamarin.Forms 3.0.0.550146 or 3.1.0.469394-pre1 (happens on both)

Here are the two errors:

/Users//Projects/MemberApp/packages/Xamarin.Forms.3.1.0.469394-pre1/build/netstandard2.0/Xamarin.Forms.targets(4,4): Error MSB4064: The "OutputPath" parameter is not supported by the "XamlGTask" task. Verify the parameter exists on the task, and it is a settable public instance property. (MSB4064) (MemberApp.Droid)

/Users//Projects/MemberApp/packages/Xamarin.Forms.3.1.0.469394-pre1/build/netstandard2.0/Xamarin.Forms.targets(3,3): Error MSB4063: The "XamlGTask" task could not be initialized with its input parameters. (MSB4063) (MemberApp.Droid)

Xaml </> needs-info ❓ bug

Most helpful comment

I'm so sick and tired of this error. When will it be fixed ?
You can change and delete and do all kinds of changes and suddenly it works, but after doing something like adding a Nuget or something else it reappears.

All 19 comments

I'm getting these exact errors consistently when I use VS 2017 (15.7.3) for Windows. My workaround is to delete all bin & obj folders and rebuild solution. I think VS is locking a dll somewhere in a debug folder. Cleaning the solution does not delete these folders (tsk tsk VS), so I created a batch file to delete them. Place the file in root solution directory and run it while VS is closed. Note that this script is for Windows, so you should find a Mac equivalent.

FOR /F "tokens=*" %%G IN ('DIR /B /AD /S bin') DO RMDIR /S /Q "%%G"
FOR /F "tokens=*" %%G IN ('DIR /B /AD /S obj') DO RMDIR /S /Q "%%G"

Source: https://stackoverflow.com/a/755433

My issue like you.I'm clean solution and restart vs to solve my issue ; you try it.

I can't reproduce the issue but I believe this is a locking issue

XamlG parameter (including OutputPath) were changed in one of the -sr for 3.0.0.
The error reported indicate that the .targets file you're using is not of the same version of the build.tasks.dll currently loaded in the appdomain of msbuild.
To fix that:

  • make sure ALL of your project targets the same version of the XF nuget
  • when you switch XF version in a project, make sure you clean the solution and restart the IDE

If that doesn't help, please report back.

@jassmith unlikely to be a locking issue

I was able to solve the issue after updating all XF nugets to the same version.
I was building an iOS build, but apparently there were problems with the outdated XF Nuget Package for Android the solution.
Closing the IDE and then afterwards cleaning the solution made it possible to complete builds again.

Worrisome is just, that it was building just fine several minutes before it started throwing errors, with the only changes being done in one xaml file between builds.

It hasn't happened to me at all in the past week. It's possible, as someone above mentioned, that it was due to having conflicting versions of the XF Nuget between my Android and iOS projects. I'll obviously keep watching to see if it happens again, but I guess in the meantime, should I close the issue, and re-open it if it does indeed happen again? Thanks!

The issue reappeared - sadly!

XAMLFiles parameter is not supported by XAMLGTask task.

I have updated all the XF nuget packages, cleaned obj/bin, restarted VS -> to no avail.

Please help! I will try to open a new issue
PS: @Asnanon : Same behaviour here, it built a couple of minutes earlier and then started throwing errors. Very worrisome, as I had the false impression I am in control of what happens in terms of updates.

I'm so sick and tired of this error. When will it be fixed ?
You can change and delete and do all kinds of changes and suddenly it works, but after doing something like adding a Nuget or something else it reappears.

I have the same issue. I have done the above solution and none of them work. I've loyal to XF but all these bug is making it hard to keep using XF. I'm starting to lean towards RN.

Thanks for the feedback and comments. you should really share your projects that has the issue so we can investigate.

The solution I am building is rather extensive. However, I can share it if it helps any... However, given the fact that reverting to an earlier version and re-doing the operations does NOT lead to the same problem, I believe the project itself will be of little help.

I would suggest another approach: when I get an error of this kind (and it IS permanent when it happens) I could upload the backup copy and the faulty project (a couple of Gigs will be necessary). Then you can investigate the differences and maybe get a clue as to what went wrong. Would this be acceptable? And if so, where should I upload the projects.

I've also had a similar experience (mobile project was previously working, suddenly begins to show this error, ensuring that all projects were targetting same XF nuget and deleting all obj and bin directories did not resolve).

For those presently stuck by this issue: I have 'fixed' things by commenting out the Target with name of 'XamlG' and 'XamlC' in Xamarin.Forms.Targets. This lets me build/debug, but I have no doubt it will bite me soon enough.

Not sure why this is closed. This is still occurring on Visual Studio for Mac with Xamarin forms 3.3.0.912540 and I don't see a real solution.

+1 @Screech129

So turns out my issue was I had accidentally added a xamarin forms nuget to my core project that didn't contain forms. Hope this helps someone.

I'm still seeing this with Visual Studio for Mac v7.6.10 and XF v3.3.0.912540. Very frustrating.

I am getting this now after upgrading to XCode 10.1 and latest VS over the weekend.
Previous VS I did not see this.

I had some success yesterday with deleting bin / obj and restarting, but now I seem to be completely jammed this morning, cannot get the droid project to run at all.

Visual Studio Community 2017 for Mac
Version 7.7 (build 1868)
Installation UUID: 6644ddea-b0f9-4b5d-bded-9635a62586be
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 4.4.1.178 (master / eeaeb7e6)

Package version: 516000221

Mono Framework MDK
Runtime:
Mono 5.16.0.221 (2018-06/b63e5378e38) (64-bit)
Package version: 516000221

NuGet
Version: 4.7.0.5148

UPDATE: I think I will list this; its pretty all over the place but "might" add value to someone.

  1. I was using LiveXAML plugin, so wanted to ensure not this, so removed those LiveXAML packages (checked project files the only thing changed are project references) and now get -

    /Users/matthewwaring/.nuget/packages/xamarin.forms/3.4.0.1008975/build/Xamarin.Forms.targets(120,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.CssGTask" task could not be loaded from the assembly /Users/matthewwaring/.nuget/packages/xamarin.forms/3.4.0.1008975/build/net461/Xamarin.Forms.Build.Tasks.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
    Done building target "CssG" in project "xyz.core.csproj" -- FAILED.
    
  2. As it mentions core above I then removed Xamarin.Forms and reinstalled it in the core project ONLY (even though its the exact same package version etc).

  3. I then got an error which was effectively -
    error apt0000 invalid start tag translate xamarin

  4. Which again pointed to a need to clean issue, cleaning and restarting actually built and ran, so I thought, let me just stash everything in git and see what happens.
    After stashing in git and project reloading, it ran / LiveXAML included (to be fair I think I missed a clean step here). So I effectively have the same code files as when I first posted but its loading?

  5. THEN
    I then restarted VS and the same error was back!
    So removed LiveXAML, cleaned / deleted bin obj, restarted!
    Got same CssGTask error, so reinstalled forms in the core only.
    Cleaned, restore packages and off we go.

  6. Restarted IDE, held breath, loads.

Could someone advise how I can send more information / open a bug report to help diagnose this when it happens again?

Thanks for your help

I had the same issue: XAMLFiles parameter is not supported by XAMLGTask task.
I was using Azure Build Pipeline. After spending several hours I discovered that the issue was being caused by a third party nuget package which was depended on an old version of Xamarin Forms.
I removed the package and the issue resolved.

I had the same issue, I was using Azure Build Pipeline. It's was working locally anyway.
After spending several hours I discovered that not all projects has the same versions of Xamarin Forms

Solution

You need to check Consolidate tab
The main solution (Right click) -> Manage NuGet Packages for solution -> Consolidate
Install similar version of Nuget package to all projects

image

Was this page helpful?
0 / 5 - 0 ratings