Xamarin Forms Project builds with errors - c#

I'm using VS2015 and the latest version of Xamarin. I'm trying to build a blank Xamarin Forms project, but when I go to just build the project, I get this error:
Download failed. Please download
https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip
and put it to the
C:\Users\warrenbr\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3
directory.
XamarinForms.Droid
So I've downloaded the zip and extracted it into the directory, tried to rebuild the project, but no dice. Is there a certain way I have to extract it, or certain folders I have to pull out of the zip?

OK, so I had to unzip the contents of the zip into a content folder for each package:
C:\Users\%username%\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3\content
C:\Users\%username%\AppData\Local\Xamarin\Android.Support.Design.v4\23.0.1.3\content
etc...
Then I ended up restarting Windows, and that seemed to do the trick. Rebuilding the solution didn't seem to fix it before this.

You need to delete all from the path: C:\Users\USERNAME\AppData\Local\Xamarin Folders and Zip files. And then rebuild your project.

Related

How to create an .exe file with external .dll?

I've tried almost everything found on the net to solve this problem, but it just seems to not work!
I created a .exe file from a visual studio 2013 project using wpf. I want this file to create pdfs, so I added as references .dlls concerning itextsharp.
Everything works fine if I keep my .exe file in the same directory as itextsharp's .dlls. But when I try to run the .exe outside, the program crashes.
I've tried to use ILMerge, I read it is pretty good to merge .exe and .dll, but when I double-click one the newly-created .exe file nothing happens.
The command I wrote in my command window, once in the ILMerge folder, was:
ilmerge C:\Users\Utente\Desktop\PDFWriter.exe C:\Users\Utente\Desktop\itextsharp.dll /out:C:\Users\Utente\Desktop\merged.exe /target:winexe /targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5"
Thanks for your help!
Use Fody.Cosura project for merging. A lot nice to work with than ILMerge.
All you need to do is to install nuget package in your project:
PM> Install-Package Costura.Fody
And you are pretty much done. You can adjust the configuration, but that is not always required as just installing the package does the bulk for you.

Xamarin studio "Error XA5209: Unzipping failed. Please download"

I created a new project by selecting the default theme as Appcompat.Light, then when I run the app, I'm getting this error:
"Error XA5209: Unzipping failed. Please download dl-ssl.google.com/android/… and extract it to the /Users/username/.local/share/Xamarin/Xamarin.Android.Support.Vector.Drawable/23.3.0.0/content directory. (XA5209)."
I haven't done anything else other than create a new project, Why am i getting this error?
The process of downloading the Android.Support.V7 or other nuget could take some time.
If in the middle of the process for some reason you quit the Xamarin Studio/Visual Studio or your internet goes down the packages being download as .zip will be corrupt.
After you try to open it again you will see that message "Error XA5209: Unzipping failed. Please download dl-ssl.google.com/android/… and extract it to the /Users/username/.local/share/Xamarin/Xamarin.Android.Support.Vector.Drawable/23.3.0.0/content directory. (XA5209)."
The solution that I follow most of the times this happens is to delete the root folder of the package where the error come from (/Users/username/.local/share/Xamarin.Android.Support.Vector.Drawable) and all the .zips inside the folder /Users/username/.local/share/zips.
Click here for more Resolving Library Installation Errors
The accepted answer did not work for me, so here is what I did to make it work. Basically the solution recommended here: https://learn.microsoft.com/en-us/xamarin/android/troubleshooting/resolving-library-installation-errors.
I am developing on Windows 10, with Visual Studio 2017 Community. The Packages are located in ..user/AppData/Local/Xamarin/....
I got errors for every package I needed, meaning Xamarin.Android.Support.Animated.Vector.Drawable, Xamarin.Android.Support.v4, Xamarin.Android.Support.Vector.Drawable and about 4 more... So I did the following (solution applies to every package), I illustrate it here for the Xamarin.Android.Support.v4 and version 23.3.0.0:
Create the 23.3.0.0 directory in Xamarin.Android.Support.v4
Create the directories embedded and content (embedded is very important)
Extract the zip (m2repository) in the content folder
From the m2repository, copy the contents of Xamarin.Android.Support.v4\23.3.0.0\content\m2repository\com\android\support\support-v4\23.3.0 to the Xamarin.Android.Support.v4\23.3.0.0\embedded directory, rename the file ending in .aar (in my case support-v4-23.3.0.aar) to support-v4-23.3.0.aar.zip, then extracting all the contents in the same folder (embedded). Note that this is package dependent, meaning for Xamarin.Android.Support.Design you will have to copy the contents of the \content\m2repository\com\android\support\design\23.3.0 folder.
Now repeat step 1 through 4 for every package that causes VisualStudio to throw an error.

Xamarin.Forms: Android project Build Error - Missing Files inside AppData\Local\Xamarin Folders

I'm trying the Xamarin.Forms.
I created a Solution named "App2". The Visual Studio automatically created the following projects:
App2 (Portable)
App2.Droid
App2.iOS
When I try to compile the Android Project (App2.Droid), I get the following errors:
Download failed. Please download
https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip
and put it to the
C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3
directory. App2.Droid Reason: One or more errors. App2.Droid
Please install package: 'Xamarin.Android.Support.Design' available in
SDK installer. Java library file
C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3\embedded\classes.jar
doesn't exist. App2.Droid Download failed. Please download
https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip
and put it to the
C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3
directory. App2.Droid Reason: One or more errors. App2.Droid
Please install package: 'Xamarin.Android.Support.Design' available in
SDK installer. Android resource directory
C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3\embedded./
doesn't exist. App2.Droid
I've already tried to:
Download the android_m2repository_r22.zip file and put it on the C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3 folder
Download the file and extract it to the folder
Delete the C:\Users\pedro.costa\AppData\Local\Xamarin\Android.Support.Design\23.0.1.3 folder and recompile project
Delete the C:\Users\pedro.costa\AppData\Local\Xamarin\zips folder and recompile the project.
Update the Xamarin.Android.Support.* nuget packages, but when I try it, I also get those build errors.
I've done a lot of research and it seems that the Android.Support.* folders should have files inside it, and that those files should be downloaded when the android solution is built, but it is not happening for me.
Try this work around :
Navigate to C:\Users\[user-name]\AppData\Local\Xamarin\zips folder.
Remove all zip files.
Remove /bin and /objfrom your project.
Clean and build your project.
It may take a while to build and debug project.
1.download
https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip
2.rename to 2A3A8A6D6826EF6CC653030E7D695C41.zip
3.copy to C:\Users\User\AppData\Local\Xamarin\zip
4.rebuild
I saw in other answers to this problem, that by just deleting all the content from the Android.Support.Design folder, Visual Studio would download it again once the project was rebuild.
The problem in my case, was a proxy issue. When I set my environment to access the internet without the proxy, Visual Studio download the necessary files and folders on the rebuild.
Don't extract the zip to \23.0.1.3folder or just put it there, that won't work don't mind the error message.
You must put the zip in the \zip folder, after you delete the already existing zip, you may need to rename the zip you downloaded to something like: 2A3A8A6D6826EF6CC653030E7D695C41.zip
But if you don't want to manually download the support repository you can just delete everything in the %USER%\AppData\Local\Xamarin\ folder and rebuild and wait.
there is a zips name folder over this address C:\Users\[user-name]\AppData\Local\Xamarin\zips
first u have to check it the file is in extract condition there we can see an error it is an currupt format then u can replace those two files
1)2A3A8A6D6826EF6CC653030E7D695C41.zip replace by this link rename with 2A3A8A6D6826EF6CC653030E7D695C41
2)96659D653BDE0FAEDB818170891F2BB0.zip replace by this link rename with 96659D653BDE0FAEDB818170891F2BB0
then rebuild the project

How Do You Clear an ASP.NET app for compiling?

I have been building and rebuilding an ASP.NET program.
I made the horrible mistake, I think, of recently copying the published content back to the folder I was developing.
So now I have an unusual error when I build the code. It says That there is a duplicate definition in one file in a temporary directory with anohter file in a temporary directory.
Error 3
The type 'ChildEventHandler' exists in both
'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files...\b90cc7a4\28d266b\assembly\dl3\c4cf1ea3\b6e4b808_ef7cce01\App_Code.DLL'
and 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET
Files...\b90cc7a4\28d266b\App_Code.asx5jp5d.dll' C:\inetpub\wwwroot...\Resources\usercontrols....ascx.cs 11 18 C:......\
I removed project and file names, of course, but this is basically what the error says.
Since the error is with temporary files, what should I do?
I do not see a "clear" option in visual studio to clear out the files of a compile.
This problem I faced sometimes back while compiling. Go to this folder
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files and delete all the files and folder under it. When you build an application which is not hosted under IIS, temporary debug files and folder get created under this folder.
It may happen that you get an access denied error while deleting them. Close your Visual Studio solution and delete everything under this folder. It will resolve the compilation error.
For those using Visual Studio 2015 in Windows 8 or Windows 10, the solution is to remove all temp files from the following location:
%AppData%\Local\Temp\Temporary ASP.NET Files
and then rebuild your Solution.
In my case, the error is come from some cshtml files that are under project folder but not included in project. So if you search the error in entire solution, it couldn't be found. You can use show all files to show the not included files, and try to open them to find the possible files that cause the error.
If you haven't got the option of "Clean Solution" (maybe Express verions, or pre-2010 don't have this?) then, to fix this error, simply go to the /bin folder of your solution and delete all items, then Build again.
This will recompile all the DLL files.

Could not find file 'obj\Debug\OldProjectName.csproj.FileListAbsolute.txt

I'm trying to publish project (tools vs2010), but cannot all the time getting the error below.
I paste to my projects files from another project and then I changed namespace (OldProjectName) to the parent project (NewProjectName). But it still getting information from somewhere about old project.
I cleaned solution, builded, rebuilded. Closed and reopened again and all the time the same error.
I'm able to build project but publish it.
Any ideas what can cause the problem?
Error 1 Copying file
obj\Debug\OldProjectName.csproj.FileListAbsolute.txt to
obj\Debug\Package\PackageTmp\obj\Debug\OldProjectName.csproj.FileListAbsolute.txt
failed. Could not find file
'obj\Debug\OldProjectName.csproj.FileListAbsolute.txt'. 0 0 NewProjectName
Open your .csproj file in notepad
Find "obj\Debug\OldProjectName.csproj.FileListAbsolute.txt"
Remove that line and save it
Open your project and try to publish it and this time you will be succeeded.
Note: if you are getting any more file like .pdb remove that as well.
Hope it will help you
Make sure the obj folder is not read only, if so change read only property of this folder to false. this worked for me.
Check the permissions to the folder obj\Debug\ if you give it write permissions, the error would go away.
Check if the folders "bin" and "obj" are checked-in to source control, if so delete those two folders in source control. There is no need to check-in these two folders to source folders. Also make sure that these folders "obj" and "bin" are deleted from your hard disk, they will be created again after a build.
Hope this will fix your issue.
It is your responsibility to make copies so you can go back to one.
Open your project file (vb/cs)proj with a notepad, and search for the missing files.
In my case I got this error when I tried to publish the project and certain files were not found.
Each publish attempt I got another file name, after checking that the file actually didn't exist in the project, I removed it from the project file, manually.
Then publish succeeded.
Delete the obj folder and build again.
Ref: http://forums.asp.net/t/1402005.aspx
Like many others these files were read only and needed to be deleted or actually able to be overwritten by VS. However, as may be the case for many others, the problem was because these files were checked in to source control. Your bin and obj folders should not be in source control. Mark them for delete and submit the changelist.
One exception to the rule is for the bin folder could be dll files that are not .Net compatible. Such as a C/C++ dll that you are using through a .Net wrapper dll. I mark them as content so that they get published and check them into source control.
I too had this problem. I resolved this by deleting files inside project bin folder (.dll and .pdb) and closed and re-opened VS .
The file named FileListAbsolute.txt was deleted from the folder obj/debug. Visual Studio can automatically recreate the file and others in the obj/debug for you.
For VS to recreate it, set the configuration of the solution and the project to debug mode. Then rebuild your solution.
To change the configuration mode to debug, from the solution explorer, right-click on the solution name and select Properties.
Select Configuration under Configuration Properties. Then select Debug from the dropdown list.
Click Apply and OK. Ensure that in Configuration Manager, the configuration mode is also a debug mode.
Then rebuild your solution.
For me using solution here: Certain Razor views not publishing
Excluding the views folder and re-including fixed it for me. So it's possible for anyone else experiencing this it may be as simple as excluding and then including the file/folder in question of your project.
I encountered this bug using VS2017 with a solution stored in OneDrive.I suspected OneDrive's sync mechanism to be the root cause of this.
When I tried to reproduce using VS2019 however it did not reappear. Looks solved in between these versions.

Categories