Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Errors on Build related to XamlGTask #2975

Closed
Osmosis311 opened this issue Jun 8, 2018 · 24 comments
Closed

Errors on Build related to XamlGTask #2975

Osmosis311 opened this issue Jun 8, 2018 · 24 comments
Labels
a/Xaml </> s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. t/bug 🐛

Comments

@Osmosis311
Copy link

Osmosis311 commented Jun 8, 2018

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)

@pauldipietro pauldipietro added this to New in Triage Jun 8, 2018
@adrianknight89
Copy link
Contributor

adrianknight89 commented Jun 8, 2018

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

@trungngotdt
Copy link

trungngotdt commented Jun 8, 2018

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

@jassmith
Copy link

jassmith commented Jun 8, 2018

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

@jassmith jassmith moved this from New to Ready For Work in Triage Jun 8, 2018
@StephaneDelcroix
Copy link
Member

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

@StephaneDelcroix StephaneDelcroix added the s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. label Jun 9, 2018
@StephaneDelcroix StephaneDelcroix moved this from Ready For Work to Needs Info in Triage Jun 9, 2018
@Asnanon
Copy link

Asnanon commented Jun 13, 2018

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.

@Osmosis311
Copy link
Author

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!

Triage automation moved this from Needs Info to Closed Jun 14, 2018
@samhouts samhouts removed this from Closed in Triage Jul 14, 2018
@tudor06
Copy link

tudor06 commented Sep 21, 2018

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.

@mikkeljohnsen
Copy link

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.

@D4rkC1own187
Copy link

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.

@StephaneDelcroix
Copy link
Member

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

@tudor06
Copy link

tudor06 commented Oct 9, 2018

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.

@wlangendorf
Copy link

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.

@Screech129
Copy link

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.

@eliottha
Copy link

+1 @Screech129

@Screech129
Copy link

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.

@aquisio
Copy link

aquisio commented Oct 28, 2018

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

@wickedw
Copy link

wickedw commented Dec 5, 2018

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.
  1. 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).

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

  3. 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?

  4. 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.

  5. 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

@yunustunahan
Copy link

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.

@ahmedmehanna
Copy link

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

@godboutj
Copy link

godboutj commented May 3, 2021

This is still happening with AppCenter Build, local build seem to be working just fine:

/Users/runner/.nuget/packages/xamarin.forms/4.8.0.1821/buildTransitive/Xamarin.Forms.targets(93,4): error MSB4064: The "References" parameter is not supported by the "XamlGTask" task. Verify the parameter exists on the task, and it is a settable public instance property. [/Users/runner/work/1/s/MyApp/MyApp/MyApp.csproj]
  /Users/runner/.nuget/packages/xamarin.forms/4.8.0.1821/buildTransitive/Xamarin.Forms.targets(89,3): error MSB4063: The "XamlGTask" task could not be initialized with its input parameters.  [/Users/runner/work/1/s/MyApp/MyApp/MyApp.csproj]

The Xamarin.Forms have been consolidate already (the solution nuget management doesn't report any package with mismatch version).

Everything is up to date (except Prism which we are still using version 6.x). The error is bad because it mask the true problem and we cannot known what is really happening or bothering the build. I don't known why this is close, but a real error for the actual problem would be required to truly fix this issue. It's a huge time waster. I still haven't figure out why it does that this time around.

@godboutj
Copy link

godboutj commented May 3, 2021

To remove the bin and obj folder under Mac OS, create a script removeBinObj.sh:

#!/bin/sh
find . -iname "bin" -o -iname "obj" | xargs rm -rf

dont' forget to add the executable flag:

chmod +x removeBinObj.sh

@mikkelAtVisma
Copy link

@godboutj does your script fix the issue, or?

@godboutj
Copy link

@godboutj does your script fix the issue, or?

Seem like the VS build can be corrupted some how, cleaning the build folders, fix the issues for me. Fixing different Xamarin.Forms version and then cleaning the build/obj folders and rebuild fix that obscure error.

Same as @adrianknight89 fix but for Mac OS

@mikkelAtVisma
Copy link

Alright, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a/Xaml </> s/needs-info ❓ A question has been asked that requires an answer before work can continue on this issue. t/bug 🐛
Projects
None yet
Development

No branches or pull requests