A deployment error in Xamarin.Forms UWP when deploying from a PC to itself - xamarin.forms

When I just installed a Visual Studio 2017 and created my Xamarin.Forms application, it ran fine on my Windows 10 PC. However, I then installed some apps from Steam (which is the only thing I can think of that could change system settings). After that, when I try to create another Xamarin.Forms project, it does not deploy well to my machine and gives the following error:
DEP6200: Bootstrapping failed. Device cannot be found.
SmartDeviceException - Deployment failed because no
device was detected. Make sure a device is connected
and powered on. [0x80131500]
Strangely enough, my first app continues to build and run fine, even if I uninstall it from Windows and then deploy it again.
What could be the issue?

I have just noticed that Visual Studio makes ARM the default architecture. Changing it to "Any CPU" brought back the option to run the app on my machine.

Related

How to build, deploy and run a Xamarin forms GTK application on a Raspberry Pi using Visual Studio 2019

I have a situation where I need to develop a multi-platform app to run on windows and Raspbian (Raspberry PI OS). Currently, I have an application written in Xamarin Forms WPF for windows and one written in Xamarin Forms GTK for use on the RPI. The issue I am having is, when I deploy the GTK version, I get one of two exception:
Development System:
Visual Studio 2019 on Windows 10 Pro
Framework 4.7.2 and .Net Standard 2.0
Target Systems
Windows 10 (Xamarin.Forms.WPF)
Debian 10 "Buster" (Xamarin.Forms.GTK)
System.DllNotFoundException: libglib-2.0-0.dll : When trying to run with Mono
The library 'libhostpolicy.so' required to execute the application was not found. : When trying to run under dotnet.
The RPI is running Debian 10 "Buster". The OS is up to date and dotnet, mono and GTK have been installed successfully. A simple "Hello World!" console app was build on windows using Visual Studio and executed against both frameworks without issue on the RPI. However, any real app with UI fails with the above exceptions.
Can anyone please provide me with information or point me in the right direction on how to resolve these issues in detail? Most of the information on the web is partial and/or makes assumptions about subject matter knowledge. Which is not really helpful.
I've researched and followed many examples online. However, they either did not work as expected or did not cover the subject of deployment to the RPI (Raspberry Pi). The system has the required frameworks and tools on it. It appears there application is missing configuration files.

UWP project needs to be deployed before it can be started

I am using visual studio 2017, created a new xamarin forms project and tried to run the UWP project. It shows the following error:
the project needs to be deployed before it can be started. verify the project is selected to be deployed the solution configuration manager, or deploy it explicitly by clinking one of the deploy commands in the build menu.
I have looked at all online solutions and only found that you need to set the cpu to x86 and to check the deploy checkbox under the configuration manager under the solution. Both these options don't work. I still get the same error. I have also tried every cpu option including ARM.
Have you tried to uninstall the existing UWP app from the Windows Start menu > All apps? Then deploy again from VS. It did the trick for me.
Sometimes when I create an app packet for win store; Visual studio seem to get hung up building to the packet (project needs to be deployed before it can be started -error).
I solve it by creating a new app packet.

Android Debugging Failing With "Couldn't connect to logcat, GetProcessId returned: 0" FFImageLoading.Platform.dll.so Not Found

I am having issue debugging Android project. I can deploy to device and run it, all works fine but if I try to debug, the app gets deployed to the device and very briefly opened, splash screen shows up but the app then closes.
I am using Xamarin Forms on Visual Studio 2015.
Device is running Android Oreo (8.0.0). Another device running Android 6.0.1 is debugging fine.
The output shows following:
InspectorDebugSession(11): StateChange: Start -> EntryPointBreakpointRegistered
InspectorDebugSession(11): Constructed
Android application is debugging.
InspectorDebugSession(11): HandleTargetEvent: TargetExited
InspectorDebugSession(11): Disposed
Couldn't connect to logcat, GetProcessId returned: 0
I checked Logcat and it seem to be having issues finding FFImageLoading library:
Time Device Name Type PID Tag Message
09-18 14:35:52.361 Huawei Nexus 6P Debug 1560 Mono AOT:
image '/usr/local/lib/mono/aot-cache/arm/FFImageLoading.Platform.dll.so'
not found: dlopen failed: library "/data/app/myapp.android.dev-
WEb1bz8edgF7vwx6uCoZ-A==/lib/arm/libaot-FFImageLoading.Platform.dll.so" not found
I have added Nuget package for FFImageLoading to my projects and Droid project references show it as in image below:
This worked for me :-
Deselecting the 'Use Shared Runtime' in Project Properties > Android
Options > Packaging properties
I also had this issue with Android 8.1 and Visual Studio 2017 15.7.4.
There are three steps to got it working again.
Under Android Options, go to Advanced and add your device architecture, in my case it was x86_64.
Go to Tools -> Options -> Xamarin > Android Settings and enable: Provide debug symbols for shared runtime and base class libraries.
And the final step is to delete following Apps from your device:
All Xamarin.Android API Support libraries
Mono Shared Runtime
Your App
After these steps you don't need to disable "Use Shared Runtime" and can Deploy and Debug much faster.
This is a known issue with Oreo and Xamarin Android on Visual Studio for Windows. It works on Visual Studio for Mac apparently. It will be fixed in an upcoming release. In the mean time there is a work around down near the bottom of the bug link above (comment 20).
deselecting 'Use Shared Runtime' in Project Properties > Android Options
delete bin & obj files from solution
clean solution
rebuild the solution it works
One another reason for that is if you dont enable usb debugging on your device, VS 2017 still recognizes your phone and installs the app on your phone. Just after debugging starts, it will throw this error and not continue debugging. Make sure to enable Developer Mode -> Usb debugging like described here
https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/set-up-device-for-development

Visual Studio 2017 Doesn't Run Core Apps with IIS Express

I am having an issue with Visual Studio 2017 RC where when I run an MVC and/or WebAPI app using IIS Express the app never actually runs. Instead I get stuck with a page in the browser indicating it is trying to attach and from there it goes no further. If I open another tab/window in the browser and try to navigate directly to the launch URL, it just spins forever. Likewise when I run this using the dot net run command, the app launches and runs fine.
There do not seem to be any errors that I can see, just that the browser spins indefinitely without actually ever loading the page/endpoint.
Note: this occurs for most any circumstance. Newly created project in VS with no changes, known working project from previous versions, etc.
You could follow or upvote the issue: https://developercommunity.visualstudio.com/content/problem/11391/aspnet-core-iis-express-httplocalhost51733-failed.html
Looks like our workarounds meanwhile are
dotnet run
Publish to local IIS. Which is working for me.
(Untested: downgrade from core-1.1 to core-1.0)
If you aren't familiar with VS2017/asp.net:
You have, or can reveal via View Menu-->Other Toolbars :
Debug toolbar --> dropdowncombobutton saying "[green arrow>] IIS Express"
Click on the dropdown downarrow part of the button.
You should see a Run {yourprojectname} option.
This is the equivalent of dotnet run {yourprojectname} from the commandline.
You can configure the options that appear in the dropdown with
Right-click on project in solution explorer --> Properties --> Debug
I had this same issue and after digging around for a while I discovered that I had dotnet preview v1.0.0-preview2 installed under Programs Files (x86) and a non-preview version in x64. I think VS is launching the x86 (preview) version but expecting to see the full version. To fix this, I did the following.
from programs and feature uninstall every visible dotnet core. (note: for me this did not remove the x86 preview)
go to https://www.microsoft.com/net/download/core#/sdk and install BOTH x86 and x64 SDK packages
open command line and from the root directory check run: dotnet --version (at the time of writing it was 1.0.4)
fire up .net core project in VS 2017 and run.
When I did all of the above, I was able to start up the site in IIS Express from VS.

Deployment failed for running windows phone8 app

I wrote first app using VS2012, Its giving error that is "Error 1 Deployment failed because no Windows Phone 8 phone was detected. Make sure a phone is connected and powered on.
"
but I did not attach any phone; I just want to run it on emulator. I am unable to select emulator from Visual Studio Device option as Its only showing me "Device" option. please help me how emulator options will come in Device options
After you install the SDK bundle. XDE emulators begin to setup themselves immediately consuming a large ram from your rig. It might have happened that you restarted your pc/laptop while the XDE was setting up.
So i would suggest you to Unistall and Reinstall again the SDK package with Update 3 to enjoy no problems. Also please note that you are running windows 8.1 pro or Enterprise/Embedded Industry pro edition.
You should have the Windows 8.
You should have a Hyper-V compatible computer.
You should enable and configure the Hyper-V. Look here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj863509(v=vs.105).aspx
If you use a laptop, development on the emulator will be a hell.
Try grant all permission level to all user for your virtual machines in this path:
C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Emulation\Images
Only restart the device or the emulator and the deployment will success
You need to have Hyper-V installed using Control Panel|Programs & Features|Turn Windows Features On/Off.
If you installed Hyper-V AFTER Visual Studio 2013, you will need to repair Windows Phone x.x Emulators in Control Panel|Programs & Features.
Reboot.
The Emulator should appear in the Visual Studio Run/F5 button.
It will take several minutes to start the emulator on the first try. It will appear to hang. Wait at least 10min. You can use Hyper-V Manager to connect to the emulator directly and view progress.

Resources