target "CssG" does not exist in the project xamarin - visual-studio

I'm using visual studio 2017, xamarin v2.5.1, I created a new xamarin forms project but I got this problem after build android project
The target "CssG" does not exist in the project.
what does this mean ?
after 3 days searching for the solution, I can't find it, any suggestions please ?

Closing Visual Studio and manually deleting the obj and bin folders worked for me! (my go-to move by the way)

I finally succeeded in solving this problem.
After building a NEW project using the Mobile App (Xamarin Forms) template, I first downgraded Xamarin.Forms to v2.5.0.280555 in all projects using Manage Nuget Packages on the references. Then I unloaded the Android project and opened the Android.csproj. In the Android.csproj I downgraded the Xamarin.Android.Support resources to 25.4.0.2, saved the document and Reloaded the Android project. After cleaning the solotion, closing it, deleting the (Android) obj and bin files and reopening the solution I could run it without errors.

Related

Error publishing .NET MAUI project: the target "_GenerateAppxPackage" does not exist

I have a .NET MAUI project that was created with VS2022 Preview 2, and it builds without errors or warnings and works as expected in the debugger. Prior to updating Visual Studio to Version 17.4.0 Preview 4.0 I was able to publish the project as a sideloadable MSIX from within VS.
Since updating, I get the following error when I click Create in the Create App Packages wizard:
MSB4057 The target "_GenerateAppxPackage" does not exist in the project.
The error is listed against the MAUI project's .csproj file.
I've tried creating a separate new, default MAUI project in the new preview - this publishes ok and (as far as I can see) doesn't contain _GenerateAppxPackage anywhere within its files or project structure. So for now I'm assuming this isn't something new that was added with the preview.
I found some references to _GenerateAppxPackage on the web but they appear to refer to Azure integration. My project is a stand-alone data transformation app that doesn't even access the net.
I'm at a loss what to try next. I don't know what this target refers to, where it should "exist" within the project, or what it does. Can anyone help me understand the problem and/or point me to a solution?
Update: 2022-10-28:
I tried deleting the project structure and creating it from scratch with File -> New Project, then adding back only the .cs and .xaml files. Publishing the recreated project gives me the same error.
I also tried uninstalling the VS preview and re-downloading and installing it. Again, publishing the project gives me the same error.
I still have no idea what is causing this, or even where to start looking.
I faced with the same problem at Visual Studio 2022 17.4.0 (net6.0-windows10.0.19041.0).
The simplest solution for me was be using the command dotnet publish directly.
At root of project just write in terminal:
dotnet publish -f net6.0-windows10.0.19041.0 -c /p:RuntimeIdentifierOverride=win10-x64
I learned today that MAUI is now in the mainline Visual Studio 2022 edition, I've tried using that instead of the preview, and I can confirm that the problem goes away. I wish I'd known about this earlier...

Xamarin.Forms Tasks don't match targets

I was working fine with in my project ,the once I updated my Xamrain.Forms to 3.0, all of a sudden I got this error :
Has anyone come across this issue? I'm kinda lost here, thanks .
Issue with my project was that, Project.Android and Project.iOS's Nu Get packages Xamarin.Forms's versions were different, so I had to update all Xamarin.Forms library in each project to the same version.
Clean, Build and it solved the issue.
Please ensure that all projects reference the same version of
Xamarin.Forms
So make sure that the statement above is correct, clean your solution and just in case restart the Visual Studio after that.
EDIT:
It seems to be a quite popular issue after upgrading to Xamarin Forms 3.0, if the steps above didn't resolve it please consider:
Delete all /bin, /obj and /packages folders within the solution
Check csproj files for duplicated Xamarin Forms references
Re-add Xamarin Forms NuGet packages
this should help:
You need to click RMB on each (Droid, IOS, UWP)-project -> Nuget -> and then update Xamarin Forms for every project to the same version, even "solution".
I would not call it a solution, but uninstalling the app from the device prior to every build was the only way forward I have found.
I tried all of the above to no avail.
What helped me was the following:
Close Visual Studio (for mac in my case)
nuget locals all -list
Delete all nuget cache folders
Restart visual studio and try again.

Existing Xamarin projects don't load correctly (needs migration), and VS crashes when creating new project?

It's been a while since the last time I worked on a Xamarin project (3~4 months), in this time I updated VS 2017 few times, now when I open a Xamarin solution, all three projects (except the portable project) don't load and there is this message "needs migration":
when I select "Reload project" from the context menu of the project, this shows up:
When I tried to create a new Xamarin project VS crashes and close:
In the period I didn't work on Xamarin, I made some ASP.NET Core projects, if the issue has something to do with that!
Can anyone please help me fix this mess?
Sln File: https://gist.github.com/mshwf/0c8989aee135420cb246cfe056aefbf6
Android project file: https://gist.github.com/mshwf/6ca1b1cefcf62e47cf34e1688d372bd2

Corrupted Xamarin.Android.Common.targets file: Errors on _CompileJava

A few days ago I tried to build a imported sample project, but this failed due some errors in the Xamarin.Android.Common.targets file. By accident I deleted a few too many lines in the file and now I cant seem to deploy my other Xamarin projects which worked before. Deployment fails on:
The target "_CompileJava" does not exist in the project.
Is there a way to recreate the targets file or to fix this issue?
Fixed it myself.
Did the following to fix it:
Uninstalled Xamarian and all Xamarian / App components using Visual Studio Installer
Manually deleted the Xamarin folder (which also contains the Xamarin.Android.Common.targets file) on C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin
Deleted all SDK Tools and Platforms in the Android SDK Manager (found in Visual Studio)
Re-installed Xamarin and all it's components as well as all the SDK platforms and tools.
This did the trick. The Xamarin folder was recreated and I can deploy my solutions once more.
TIP: If you got the same problem, don't forget to make screenshots of your SDK tools and platforms and installed Xamarian components.

the target "UpdateDesignTimeXaml" does not exit in the project error in Xamarin Studio

I am new to mobile application developing. When I was creating a new .xaml file in new solution in the Xamarin Studio.
It gave the error:
"the target "UpdateDesignTimeXaml" does not exit".
How can I resolve this problem?
Build errors can occur if you have updated the Xamarin.Forms nuget to a newer version that requires UpdateDesignTimeXaml.
Close and reopen Xamarin Studio.
Clean all and ReBuild your project.
Ref: https://forums.xamarin.com/discussion/49152/problem-initializecomponent-and-pcl
A workaround for this is to remove the MSBuild:UpdateDesignTimeXaml from the Custom Tool of the xaml file properties in VS. Save, add MSBuild:UpdateDesignTimeXaml again and save again will force MSBuild to recreate the *g.cs file.
I had this with Visual Studio for Mac.
I fixed it by:
closing VS
manually deleting the packages, bin and obj folders
restart the project in VS
restore NuGet packages, build and run.
Got same issue in Visual Studio for Mac. Worked find with
closing VS
manually deleting the packages, bin and obj folders in both android folder and main folder
restart the project in VS
restore NuGet packages, build and run.

Resources