I am working on a Xamarin IOS project and just created a .png file that I want to display in the app. When I add the image to the Resources folder the app no longer builds and displays the following error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3): Error: System.IO.FileNotFoundException: /Users/davidshepard/Projects/NewEPA/NewEPA/obj/iPhoneSimulator/Debug/device-builds/ipad6.12-11.0/optimized/Pres0.png does not exist
File name: '/Users/davidshepard/Projects/NewEPA/NewEPA/obj/iPhoneSimulator/Debug/device-builds/ipad6.12-11.0/optimized/Pres0.png'
at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00193] in /Users/builder/data/lanes/4992/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/File.cs:111
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile (System.String source, System.String target, System.String targetItemSpec) [0x00030] in <3718405664a748fa8803db38a9584ea4>:0
at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute () [0x0013d] in <3718405664a748fa8803db38a9584ea4>:0 (NewEPA)
I verified that the file was being added to the .csproj file and I still get this error even when I do reference this image anywhere in my code other than the .csproj
Another interesting piece of information is that Images that I added before upgrading to the newest version of Xamarin.IOS and Visual Studio for Mac 2017 work just fine even if I remove and readd the m to the project.
Any suggestions as to how I can resolve this issue would be greatly appreciated!
Additional Info: iPad only app. IOS 11.
So after a scratching my head for a few days, I figured out what went wrong. When I was uploading the file to Visual studio, it was becoming corrupt and unreadable. I had to reinstall visual studio to fix the issue and now it's working fine. If you experience the same problem, it is most likely due to the file being corrupt. Hope this helps someone in need!
Related
I can't rebuild the project and I'm getting this exception after updating to latest Xamarin Forms 3.4.0.1008975 , if I downgrade it to 3.1.0.583944 or lower the exception will gone and I can build successfully.
I've tried to update VS and clean - close - reopen but the problem still there , I also tried to move the project to C:/ but no luck .
Error The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'SouqAlData, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'SouqAlData.dll'
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() SouqAlData.Android
My understanding of the situation tells me that you do not have the latest version of Xamarin which comes along with Visual Studio 15.9.xx.
And hence when you update your Xamarin Forms package to the latest version of that is available it sees a discrepancy in between the versions and hence might be throwing this. One more reason could be that when you update your Xamarin Forms package, somehow the path for your SouqAlData.dll is lost by VS and hence you get this error. What I would suggest you do in case two is that you provide the proper path for your .dll again to VS and see if that helps you build the project.
You can give the path as follows:
Remove the existing reference to the .dll
In your project go to References>Add Reference>Browse then give it the .dll path from your solution directory.
Update:
From recent Xamarin forms update code behind doesn't support Task return type as signatures for event handlers.
So Replacing the Task with Void return type did the trick. Reference
This error happens when you have another error in the solution in your case in xaml file check for you xaml code for a mismatch code or events. In my case i found "-->" in the xaml file and it was the problem.
I'm running Visual Studio for Mac and for quite some time all of my xaml files are not showing anything in the previewer and are giving the following message: "The base class associated with this XAML file could not be found. Please double check the class referenced in the 'Class' attribute exists and that the project has been compiled"
Of course I've checked that it does exist and everything compiles successfully. This has been going on for some time in this project in all xaml files even though it runs just fine in the simulator and on devices.
How do you fix this? Here's a screenshot:
I had the same problem.
Since there is no compilation error. Just run the app, check if all the pages you added are working fine and then close app.
Now Rebuild the solution and the design error will be gone.
I don't know why but it worked for me. Hope this helps!
This is the bug exist in Xamrain.Forms Previewer in Visual Studio 15.5 onwards. This issue has already been filed by me on VS developer community.
There is solution like cleaning, rebuilding and deleting obj & bin folder of android project. Best option is to use VS2019.
I had this problem fairly recently in a new project. Something was crashing in my code when using the designer (worked fine at runtime on device and simulator). As the exception wasn't going away, I deleted the bin and obj directories throughout the project, and restarted Visual Studio.
Then, the exception went away, but this exact problem occurred: base class associated with the XAML not found.
I rebuilt, restarted, did all that, it just wouldn't go away.
That was until I built the iOS project for the device (not the simulator). The key to this was looking in the log file (~/Library/Logs/VisualStudio/7.0/iOSDesigner.TIMESTAMP.log), where there was this line:
[2019-02-19 14:49:52.0] INFO: These assembly will not be uploaded as they cannot be found on disk:
[2019-02-19 14:49:52.0] INFO: /Users/***/src/my-app/bin/Debug/netstandard2.0/my-app.dll
Debug is the device build, not the simulator.
After I rebuilt the device build ("generic device" was fine), suddenly the XAML previewer started to work again.
It would seem that the previewer uses a mix between device and simulator builds, and the text editor itself to update the preview. How.. weird.
I am trying to debug this error from past 3 days but still unable to solve it. Hope anyone of you can help me and probably others in future.
Where its failing: Whenever I try to deploy the app, deployment fails, with this error:/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2112,3): error : Could not find a part of the path '/platforms'.
Though prior to this there are few warnings as well like,
AndroidManifest.xml //uses-sdk/#android:targetSdkVersion '21' is less than $(TargetFrameworkVersion) 'v7.0'. Using API-24 for ACW compilation
Some random conflicts.
But these are only warnings, and I shouldn't be concern about them.
What I did so far:
Uninstall/Install Visual studio
Tried downloading Xamarin studio through its dmg, thinking its IDE issue, but in vain.
Downloaded all relevant android sdk platforms.
Deleted/Again loaded the whole project.
but everything in vain. I will be highly thankful if anyone can help me in resolving this or atleast guiding me right direction.
Note: My visual studio version is 7.0.1, if this is of some help.
A more detailed error: /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Could not find a part of the path '/platforms'. at System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) [0x00207] in /private/tmp/source-mono-2017-02/bockbuild-2017-02/profiles/mono-mac-xamarin/build-root/mono-x86/mcs/class/referencesource/mscorlib/system/io/__error.cs:188
Solved it myself:
Added the ndk path from Tools -> Add Custom tools -> SDK location -> Android. Look for ndk path, enter the same and run.
Thanks everyone for your help!
I found many people asking this same question, but very few answers.
First, if you get the error saying it can't find c:/platforms (or d:/platforms etc. depending on which drive the project is stored on.) it is probably because you don't have Android NDK installed. I thought this would have been installed with Xamarin, but - Nope.
In Visual Studio 2017, Navigate to Tools menu --> Options --> Xamarin --> Android Settings.
Notice the Andriod SDK Location and Andriod NDK Location. In my case, the NDK was blank.
I downloaded the NDK from https://developer.android.com/ndk/downloads/ and then unzipped it to "C:\Program Files (x86)\Android\android-ndk-r12b"
The problem is which version to download. At this time, version r19 Beta 2 is the current release, but a known bug in Xamarin causes this NDK to throw other errors when you try to archive. According to https://bugzilla.xamarin.com/show_bug.cgi?id=48678, Version r12b is the last version to work with Xamarin. Therefore it went to the NDK site, clicked on older versions, and choose the r12b 32bit version, downloaded, unzipped, and then saved that path in Tools menu --> Options --> Xamarin --> Android Settings-->Android NDK Location.
This solved many problems and allowed a successful Archive.
Go to:
Tools->Options->Xamarin->Android Settings
Changing Archives Location in settings worked for me.
The path of Android sdk location you are pointing to the project maybe changed.
Check in visual studio Tools->Option->Xamarin->Android settings
install ndk, then setting ndk path:Tools->Option->Xamarin->Android settings
this is my ndk path:C:\Microsoft\AndroidNDK64\android-ndk-r15c
Am a newbie to windows 10 uwp having migrated from wpf applications. I know this question has been asked before but none has been able to solve my problem.
Recently, I attempted recreating the Hamburger menu for a uwp application I am creating by following the instructions on a GitHub page.
Everything was going on well till I encountered the error "Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) ". After debugging, I realized the following line of code caused the error
<Setter Property="BorderBrush" Value="{x:Null}" />
Just to explain the project from the GitHub page; assuming you have a blank uwp xaml page, you have to add 2 files shell.xaml and shell.xaml.cs to your project as well as modifying the app.xaml. Further instructions are on the Github page. I added this but after running this I encountered the error.
I also tried the instructions from here but to no avail. Am quite confused with the explanation because I could not find the COMPONENTS as described on the page.
Please any suggestion will be helpful.
I encountered this Error: Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) in Visual Studio 2017 when just changing the Solution Configuration from Debug to Release.
Fortunately, reopening Visual Studio eliminate this error.
Seems various causes lead to this error: in Visual Studio 2019 Community Edition (Studio Version 16.5.3) I added a Windows Form to an existing project, named it including the ending .cs - did not like that at all. I was not able to save the project, neither that specific file nor the project but was confronted with the 'catastrophic error...'. Luckly copy/past to Visual studio 2017 and past into newly added, blank form (that worked smoothly!) although the same problem occurred until I added the new form without suffix .cs!
No sure if this will help but I had the same error when creating a project in Visual Studio 2019.
So I tried changing the location where the project is created and it worked. Seemed the path was too long but Visual Studio gave this super unhelpful error instead of just saying the path is too long.
Anyways hope this helps atleast someone.
I faced the Same error in Visual Studio 2022; it took me 3 hours to resolve this problem.
I had no idea why this error occurred when I opened the View Designer of myForm.h file.
To resolve the problem, I deleted unnecessarily debug build folders from the project's repository. I only kept the single Debug directory and deleted the Release 64X and 84 directories. If you face the same problem, you can delete the unnecessary directory from your project repository and rebuild the project.
I'm having all kinds of problems getting Visual Studio 2010 to work with the Windows Phone 7 templates. All I have is a default portrait view added to the project, and the designer gives me the following error:
System.IO.FileNotFoundException
Could not load file or assembly 'Microsoft.Phone, Version=7.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e' or one of its dependencies. The system cannot find the file specified.
followed by a bunch of crap that doesn't seem too helpful. If I rebuild the project and refresh the designer, it momentarily appears correctly (less than a second), and then Visual Studio crashes and tries to restart.
Anyone have any idea why this might be happening?
Well, sounds like the install didn't go well. Verify that this reference assembly is located where it is supposed to be, the default install location is c:\program files\reference assemblies\microsoft\framework\silverlight\v4.0\profile\windowsphone. Randomly retrying to reinstall might pay off but do check your machine health first, this doesn't go wrong very often. Ask questions about that at superuser.com