If you have a project that transitively references different versions of Xamarin.Forms, you get errors like this:
2>------ Rebuild All started: Project: XFTransitiveMismatch, Configuration: Debug Any CPU ------
2>C:\Users\elipton\.nuget\packages\xamarin.forms\4.3.0.908675\build\Xamarin.Forms.targets(116,4): error MSB4064: The "ValidateOnly" parameter is not supported by the "XamlCTask" task. Verify the parameter exists on the task, and it is a settable public instance property.
2>C:\Users\elipton\.nuget\packages\xamarin.forms\4.3.0.908675\build\Xamarin.Forms.targets(110,3): error MSB4063: The "XamlCTask" task could not be initialized with its input parameters.
2>Done building project "XFTransitiveMismatch.csproj" -- FAILED.
There seems to be little information on the Internet about this.
If you consolidate all Xamarin.Forms packages to a single version, that fixes it.
However, in some cases you might be using 3rd party packages that have different dependencies and you can't consolidate on your own, leaving a developer to be stuck.
In preference order:
You get an error with a difficult-to-diagnose error.
Details of the solution:
The following issues look like they could be mitigated by a fix for the root cause of this issue:
Perhaps have some detection logic in the Targets or in the Task DLL that states its version, and check that version against its other half to ensure that a new _task_ isn't run by an old _target_, or perhaps worse, an old _task_ is run by a new _target_ (this bug).
I have the same issue when upgrading Xamarin.Forms from v4.2 to v4.3. But I'm not using mixed Xamarin versions. I just have a Uwp project that references some .net standard 2.0 projects.
@yanxiaodi do you have details on your solution/project structure? Or a repro project you can share on GitHub?
@Eilon Sorry my fault. I checked my solution and some other .net standard projects also reference Xamarin.Forms. The error is gone after I upgrade all the Xamarin.Forms versions.
@Eilon Sorry my fault. I checked my solution and some other .net standard projects also reference Xamarin.Forms. The error is gone after I upgrade all the Xamarin.Forms versions.
I am also starting to see this message intermittently. This happens randomly, I would be able to build and deploy successfully multiple times, and then randomly the build would fail. The only solution is to close VS19 and open the project again.
Using Xamarin.Forms 4.3.0.991211, no updates, same nuget packages across my iOS and Android solutions.
Same here .. It's completely wasting my time. I have been rebuilding/cleaning - rebuilding/cleaning back and forth on the projects in my solution. The build succeeded after cleaning, the fails agian.
Wasted a lot of my time that is supposed to be for fixes and updates in our project.
What's funny is that, the build fails even after cleaning or restarting VS, but after restarting the OS, the build succeeded... Doesn't make any sense to me in my level.
-- XF 4.3.0.991211
oh yeah,, we also have ah command that automajically removes all OBJ and BIN folders inside the solution.. still no luck.
same error.
tmp solution:
open that target file, remove param ValidateOnly.
Oh...spent a day trying to build my project, but still that the error keep blocking me.
@gezanna - are you able to move all your projects to use the same version of Xamarin.Forms?
I have a project with only one reference to Xamarin.Forms
.
All 4.3.x
series fail to build on UWP with this error.
The workaround was to revert to latest 4.2.x
.
Note, the issue still shows up in latest preview 4.4.0.991210-pre2
.
@Eilon, sorry for my late reply. However all my projects use the same version 4.3.x. I guess i will have to revert back to 4.2.x, and restart from there. It's so painful though.
I've solved this problem by re-install xamarin form on my project.
I Followed these steps to solve this problem after I upgrade XF from 4.2 to 4.4 using VS 2019
1- Clean All Solutions
2- Rebuild All
3- Close & Re-Open VS
I Followed these steps to solve this problem after I upgrade XF from 4.2 to 4.4 using VS 2019
1- Clean All Solutions
2- Rebuild All
3- Close & Re-Open VS
Order is wrong.
Step 1, Step 3, Step 2 worked for me.
This still happens randomly in 4.4 stable, not related to different versions, can someone leave this open?
I got here because of the same error. Read everything you guys wrote and it gave me an idea of what could be the cause of error in my case.
The solution I was working on had the same Xamarin.Forms version (v4.4) on all three projects (App, App.Android, App.iOS). It wouldn't deploy due to 4 errors, two of them verbosely related to XamlCTask.
Now the problem was that I was copying bits of code from another solution opened in a different window of the same Visual Studio 2019 Community. That one indeed had a different Xamarin.Forms version. The two solution aren't related in any way, since I just got cloned the other one minutes before the error. Closing both windows and reopening just my solution did the trick.
Hope it helps anyone.
PS: I understand that this has nothing to do with how the error is treated by VS and if it explains anything useful the the user wanting to debug the error.
@Eilon Can somebody suggest me way out of this issue ? Below step does not help at all:
1- Clean All Solutions
2- Rebuild All
3- Close & Re-Open VS
I could reproduce the error again by going to a 4.3 branch (same project), rebuild and go to a 4.4 and rebuild.
Unloaded the project reporting the Xamlctask error (I have several projects with several Views in it, same XF version) and removed it's dependencies from Core project.
Rebuild works.
Reloading the "offending" project and rebuild breaks it again with same XamlcTask error
Still figuring out what would it be Xamarin build does not like about my project.
Target XamlC:
13> Building target "XamlC" completely.
13> Output file "obj\Debug\netstandard2.0\XamlC.stamp" does not exist.
13> Using "XamlCTask" task from assembly "C:\Users\J\.nuget\packages\xamarin.forms\4.4.0.991265\build\net46\Xamarin.Forms.Build.Tasks.dll".
13> Task "XamlCTask"
13> C:\Users\J\.nuget\packages\xamarin.forms\4.4.0.991265\build\Xamarin.Forms.targets(116,4): error MSB4064: The "ValidateOnly" parameter is not supported by the "XamlCTask" task. Verify the parameter exists on the task, and it is a settable public instance property.
13> C:\Users\J\.nuget\packages\xamarin.forms\4.4.0.991265\build\Xamarin.Forms.targets(110,3): error MSB4063: The "XamlCTask" task could not be initialized with its input parameters.
13> Done executing task "XamlCTask" -- FAILED.
Between builds did you do a git clean -xdf
to remove all generated files? Sometimes changing package/reference versions leaves old stuff in the bin/obj folders. That git command will delete all files not in source control (so be careful 馃槃 ).
@Eilon you rock! I did't know about that super clean command, much better than VS clean, that fixed one part of the problem of reproducing the solution.
For me the the "root" cause seems to be related to the csproj file artifacts created when adding new views or copying ones like these things:
<None Update="App.xaml">
<Generator>MSBuild:Compile</Generator>
</None>
<ItemGroup>
<EmbeddedResource Update="Folder\SomeView.xaml">
<Generator>MSBuild:UpdateDesignTimeXaml</Generator>
</EmbeddedResource>
md5-cb3e3bc860df39dc295f6281d3145939
<Compile Update="Folder\SomeView.xaml.cs">
<DependentUpon>SomeView.xaml</DependentUpon>
</Compile>
The "fix" is just to delete all these, I think the new csproj structure does not need it, this may create some files xamarin won't like, which are gone with the git clean.
From this can't really tell the root cause but hope there is an answer for that.
VS/MSBuild Clean only cleans up things that the current state of the build knows about. So once you change dependencies, VS no longer knows that you once had some other settings in a previous state, so it won't/can't clean up certain stale contents. git clean -xdf
doesn't care about any of that 馃槃
I've solved this problem by re-install xamarin form on my project.
This helps a lot, thanks 馃槉
I'm having the same problems in my DevOps pipeline.
Below some YAML from my pipeline to potentially help identify or narrow down the possible issues:
Host agent: macos-latest
Xamarin SDK: - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 6_6_0
(NOTE: I tried also with 6_4_0
version, which gave the same results)
Using XamariniOS@2
task to build
Can provide logs if that might help.
I have same problem but it giving me error on AppCenter app is running fine
I have fixed it "permanently" by removing any implicit reference to different versions, you may have implicit references on projects not referencing XF directly which will take the min XF version of other dependency, things like Lottie, Prism.Forms, etc. You can see that in build output also.
Just explicitly install XF on all csproj directly or indirectly using XF.
Still a mistery why git clean -xdf work (sometimes)
Upgrading from XF 4.3 to 4.4 was all I needed to do
I update to xf 4.5
I'm not sure what you mean @lindexi by saying that you've updated to latest stable Xamarin.Forms but I've done the same (update my project to latest Xamarin.Forms 4.5.0.356
) and the build in my DevOps pipeline is still throwing same errors.
@mkieres I upgrade to 4.5 from 4.3 and solve it. And before I upgrade it, I try to clean my code by git clean -xdf
but can not solve it.
I have removed all packages & reinstalled the one I need. Even then this issue is killing me
/Users/satindersidhu/Projects/PunjabiMaa/packages/Xamarin.Forms.4.5.0.396/build/Xamarin.Forms.targets(90,4): error MSB4064: The "XamlFiles" parameter is not supported by the "XamlGTask" task. Verify the parameter exists on the task, and it is a settable public instance property.
/Users/satindersidhu/Projects/PunjabiMaa/packages/Xamarin.Forms.4.5.0.396/build/Xamarin.Forms.targets(89,3): error MSB4063: The "XamlGTask" task could not be initialized with its input parameters.
0 Warning(s)
2 Error(s)
Its happening for me on VS mac latest version 8.5.2 build 13
For your information, this error also occurs for me at work. We're using Xamarin.Forms 4.5.0.617, all packages are on the same version number. Only the incremental builds fail sporadically (done with /t:Build
); full rebuilds work without problems. Maybe this info is helpful for finding the error.
After some more testing I get the impression that this error also appears when building two separate solutions, one with an older Xamarin.Forms NuGet package and one with 4.5.0.617. My guess is that there are MSBuild processes still active from a 4.2.0 build that has the Xamarin.Forms.Build.Tasks.dll loaded, and then a build with Forms 4.5.0 reuses this MSBuild process but can't find the ValidateOnly property, since the 4.2.0 .dll is still loaded. Worth checking your processes with Process Explorer which one of the .dlls is loaded.
I don't know yet how to force the MSBuild tasks to either unload the .dll or to exit.
Here's a link with a workaround (not reusing MSBuild processes in automated builds) that may help some of you with this problem: https://nftb.saturdaymp.com/fixing-msbuild-not-exiting/
This is happening for my team on AppCenter Build but not locally. We are running Xamarin.Forms 4.6 on UWP but previously was 4.4 and still causing issues. We upgraded hoping it'd fix this.
This is happening for my team on AppCenter Build but not locally. We are running Xamarin.Forms 4.6 on UWP but previously was 4.4 and still causing issues. We upgraded hoping it'd fix this.
We fixed this by making all projects use the same version of Xamarin.Forms. The problem was our UnitTest project.
I've run into this when updating Xamarin.Forms versions from older (circa 2.4) versions to 4.x. If you've tried everything else and you're still seeing this error, check your build output to see if an old cached version of the XamlCTask (from a previous Forms version) is being loaded.
In that case, you may be able to fix it by clearing your NuGet cache:
nuget locals all -clear
.I confirm, the root cause of the issue is different versions of Xamarin.Forms in the solution. In my case it was very surprising. Different versions were used in completely unrelated projects. There was no reference between them whatsoever. All of the projects referenced Xamarin.Forms of version 4.6.x but I had a Tizen project in the solution and that Tizen project referenced another project and that other project referenced Xamarin.Forms of version 4.2.x. Even though 4.2.x version was referenced in the Tizen project the error was displayed for one of the other projects. Every time it could be a different project and the issue was sporadic. Fortunately I could update the project version for Tizen project to 4.6.x and that resolved the issue once and for all.
I ran into this a little differently than anyone else so far (I think):
The root cause was the ZXing.Net.Mobile.Forms 2.4.1 nuget which we were using. This made the VS Mac build pull in Xamarin.Forms 2.5, resulting in the conflicting versions of Forms. Luckily we could drop the nuget, so that was our solution, and the VS Mac build works for us now.
This looks a lot like a bug in Visual Studio Mac. Since the build succeeded on Windows, it should have succeeded on VS Mac. The netstandard project in our solution is not platform dependent, so shouldn't have different build results.
@david-js
This looks a lot like a bug in Visual Studio Mac. Since the build succeeded on Windows, it should have succeeded on VS Mac. The netstandard project in our solution is not platform dependent, so shouldn't have different build results.
I did had this problem too on a Mac but @hartez solution allowed the project to compile and run
1. Close Visual Studio 2. Clear out your NuGet cache with `nuget locals all -clear`. 3. Reopen Visual Studio and build again.
I do also have different dependencies versions on a solution and encountered this problem after adding a project (.csproj) targeting a previous version
Most helpful comment
I am also starting to see this message intermittently. This happens randomly, I would be able to build and deploy successfully multiple times, and then randomly the build would fail. The only solution is to close VS19 and open the project again.
Using Xamarin.Forms 4.3.0.991211, no updates, same nuget packages across my iOS and Android solutions.