Error in VS2015 installation and Xamarin UWP not working - xamarin

I'm trying to install VS2015 Community in my PC.
When I install everything at the end the installer gives to me the following message:
I've tried to install, reinstall, update but anything changed. The only consequence that I can see is that when I create a new Xamarin solution, when I run the UWP project using Local Machine as target it starts, but then I obtain this exception message.
If I run the application from the Mobile emulator, it starts without problems.
Somewhere (sorry, I forgot the source) I've read that I should be sure to add following references for the project:
Windows Desktop Extensions for the UWP
Windows Mobile Extensions for the UWP
But I've only the first one, not the second. Maybe it's related to the installation issue?
I'm new to Xamarin and UWP, but UWP should be run to both Mobile devices and desktops, so why I have this behaviour? and what I can try to solve the installation problem that's probably related to this?
So, at the end, what I can try in order to fix the installation and allows the xamarin UWP project to run correctly in the local machine?

If I run the application from the Mobile emulator, it starts without problems.
According to your error message, it seems you are using StatusBar in your project.
While using StatusBar, please note that this is not a Universal API, this class can be only used in Mobile Device. Because status bar only exists in Mobile devices, there is no such thing in desktop, table or IoT devices. So if you use this class on Local Machine, you will get an error, but in Mobile Emulator, it can work without problems.
For more info, please see Requirements section of StatusBar.
Usually, when using StatusBar, we would use it with Runtime API check like following:
Windows.UI.ViewManagement.StatusBar statusBar = null;
if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
{
statusBar = Windows.UI.ViewManagement.StatusBar.GetForCurrentView();
}
if (statusBar != null)
{
//TODO
}
On Local Machine, as there is no StatusBar, ApiInformation.IsTypePresent method will return false. This will help us avoid the error. For more info, please see Write adaptive code.
But I've only the first one, not the second. Maybe it's related to the installation issue?
I'm not sure why you can't find the Windows Mobile Extensions for the UWP. But if you have used StatusBar and can build and run your project in Mobile Emulator, then you must have referenced Windows Mobile Extensions for the UWP. Without this extension, we can't use StatusBar and the build will fail.
Depending on the SDK you've installed, you can find following extensions in Reference Manager (Right click "References" in your project and then select "Add Reference" → "Universal Windows" → "Extensions").
I'd suggest you create a new Blank App (Universal Windows) project with Visual Studio to see if you have both the Desktop Extensions and Mobile Extensions. If you still have problem in new Blank App, I'd suggest you use Visual Studio Uninstaller to uninstall Visual Studio completely and also check the Control Panel to make sure you have uninstall all related stuffs like the SDKs. Then you can try to reinstall Visual Studio to see if it works.

Related

development app is deployed on IPhone, but I cannot start it

I have an app in Xamarin that I want to test on a physical IPhone (normally I test it on Android). I'm connected to a Mac, the development certificate is working and everything is deployed to the point that the app is actually installed on the IPhone itself. The issue however is that when I press the icon to start the app, it tries to start it and then is closes right after that (like it crashes or something).
I'm using Visual Studio for Windows, and it is stated that: "XAML Hot Reload encountered a problem and failed to start. Verify the Mono Interpreter for is enabled in the project settings, clean and rebuild the solution.". Mono Interpreter is enabled, I cleaned the solution and rebuild it multiple times. There are no errors given.
The app that is installed now shows the Xamarin icon and Xamarin splash screen (so not the custom one I designed). I don't mind that, but I'm not sure if that has something to do with this.
Does someone know what is wrong here and how to fix it?
Visual Studio for Windows version 17.4.1
iOS version 15.5
Note: this issue is only with the development and deployment directly from Visual Studio from Windows. When the app is distributed to the users (in App Center) the app works as it should.

Xamarin workflow on Windows

I'm aware that a Mac or a Mac service e.g. MacInCloud.com is necessary for building and submitting iOS apps.
My question is about the actual workflow of building an app on Windows using Xamarin on Visual Studio 2017.
We need to write code, test and debug throughout development cycle. How does this work with Xamarin running on Windows? How would I actually see what my mobile app looks like or behaves during the actual development cycle?
While developing my web apps in Visual Studio, there are many trips back and forth to the browsers and back to VS in order for me to see the results of my code. How does this work with Xamarin running on Windows? Is Xamarin Live Player the only option for development cycle? Is there a solution through MacInCloud or similar services so that tethering a device to dev machine is not necessary?
I'm just trying to understand how a healthy development cycle is created for Xamarin developers on Windows.
I will answer your question in few section: Coding, Debug, Test
Coding
You will be using Visual Studio to write your codes. iOS and Android code will be written in C#. You will get access to UI Designer for both iOS and Android to edit the layout files and storyboard/xibs. For 3rd party library, there is NuGet to serve your needs.
Debug
You can use Xamarin Live Player without connection to a Mac/MacInCloud for basic preview. However, some features of iOS is not available in Xamarin Live Player (e.g. xibs files not supported...).
If you setup with connection to a Mac, you will be able to see a list of Simulator that available in the Mac you connected to. By default, if you debug it, the simulator will still show up in the Mac. Then you will need to VMWare or remote into the Mac to check the simulator output. If you have Visual Studio Enterprise license, you can get access to a Remote iOS Simulator feature. You will need to turn the option ON. After that, you will able to see a remote iOS Simulator showing in your Windows machine without the needs to remote into Mac machine anymore. For debugging in actual iOS devices, you will still need to plug your device into the Mac. Previously (more than 1 years ago), Xamarin announce that they are working on "iOS USB remoting" to allow you to plug in iOS device into Windows machine and debug on it. But it is not release until now.
For Android, you can get access to Android Emulator Manager to add emulator to debug or you can deploy apps to physical phone just like what you can do with Android Studio.
Test
I will be referring to Xamarin.UITest for this part. You will be able to write UITest code in C# inside Visual Studio. Xamarin have product "Xamarin Test Cloud" to allow you to upload test code and binary and then run your test in cloud periodically. If you want to run the test locally in your machine, you will only able to run Android UITest in windows machine. To run iOS UITest locally, you will only able to run it in Mac machine. Using a Mac, you can also run Android UITest.
You can use a simulator/emulator instead of a device. For iOS, the simulator would run on the Mac Build Host that you are connected to. You can select the option for "Remote iOS simulator" in Visual Studio -> Xamarin.iOS options and you'll be able to interact with the simulator without having to RDP/VNC/look at the mac. For android, you can just run an emulator in Window and interact with it like that. Using your web apps comparison, you would use a simulator/emulator instead of browser but, for the most part, the process would be similar.
I have been developing a Xamarin MVVM app targeted at iOS and Android. I initially did the iOS development on Windows with VS 2022 and an iPhone attached via USB. I knew that I was going to have to eventually move to the Mac for final provisioning but I ended up taking that painful step earlier than planned because certain Xamarin features were just not working on Windows. First I could not get my app icon to be anything other than the Xamarin default and then Xamarin.Essentials.FilePicker would not select a file:
https://github.com/xamarin/Essentials/issues/1710
So after a week of struggling I finally got my project building and deploying on the Mac. However, I am not nearly as comfortable working on the Mac as I am on Windows where I have all my familiar development tools. So then the question was how to share the project files between the PC and the Mac so that I could edit and compile on the PC and then move to the Mac for final testing.
At first I tried iCloud but I could never get the files to sync reliably between the shared folder on the PC and the Mac. I am used to Dropbox and OneDrive, which work as expected. iCloud not so much.
So what I have been doing is committing and pushing the changes to github and then pulling the changes into the project on the Mac. It is quick and has the added benefit of version control using an offsite server. I am happy with this workflow and publishing the app on the Apple Store should be an easy task when that time comes.
Update:
This process is still working for me. I have taken the additional step of doing the release configuration on VS Mac and publishing my app to App Store Connect. That experience was convoluted and frustrating but it now works and I have people testing my app via TestFlight.
One hiccup is that when selecting Automatic iOS Bundle Signing in the project properties on VS Windows, this change gets pushed to the Mac side and causes a build error under Debug until I select the Automatic provisioning profile on the Mac. Somehow it gets set to the Wildcard profile on the Windows side.

Couldn't Start UWP project in Xamrin Forms

I am starting my first Xamarin Forms application using Visual Studio 2015. The default template provided 6 Project. (Android,iOS,PCL,UWP,8.1,windows phone).
All the projects works correctly including the Android,8.1,Windows Phone Emulator.
But when i try to deploy the UWP project , breaks (Exception) at the first statement where it calls the MainPage inside PCL. This happens in both Local Machine and Emulator. (debug Mode , All CPU).
I have already updated xamarin forms to the latest stable release, updated Visual Studio but i am not able to resolve the issue.
Exception:
An exception of type 'System.TypeLoadException' occurred in
Xamarin.Forms.Platform.UAP.dll but was not handled in user code
Additional information: Could not find Windows Runtime type
'Windows.UI.ViewManagement.StatusBar'.
Please Help
The Windows.UI.ViewManagement.StatusBar is a type that is only available in the Windows Mobile Extension SDK and you have to reference this SDK for it to be available.
Right-click your UWP project in the Solution Explorer, select Add -> Reference, then under Universal Windows select Extensions and find Windows Mobile Extensions for the UWP. Check the one that matches the targeted Windows 10 build version of your app.
You also need to use the IsTypePresent API, which will check at runtime if the type is available on the current device. This is important, because StatusBar does not exist on any other version of Windows 10 than on Mobile:
if(ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar") )
{
//your code
}
Look like issue in xamarin UWP concept , are you updated Xamain.Forms ?
Goto Tools-> NuGet Package manager -> Manage Package for Solution -> Microsoft.NETCore.Universal Windows Platform -> update latest version.
after updated all , still same problem please check here some around
https://forums.xamarin.com/discussion/64731/how-to-solve-unknown-type-in-uwp-app-windows-ui-viewmanagement-statusbar
If none of this work try updating your windows SDK to the latest version. It worked for me. I also added the reference to Windows Mobile Extensions for the UWP.
EDIT:
I also have experimented that sometimes when you update visual studio it fails again. I had to manually change de SDK version in my UWP project, going to Properties > Application > Target Version > Select latest version

DEP3316 Error - Cannot deploy to Win10 Phone from Visual Studio 2015

I am unable to deploy an application via Visual Studio 2015 Update 2 to my Lumia 650. In the past it was possible but now I get the following error indicating to change the build configuration of a project or add an ARM device.
The build config is set to 'ARM', the device is connected via USB and my configuration manager looks like this.
The platform targets seem correct, so the config setting 'ARM' points to the platform target 'ARM'. I can run the app on my local computer, but I cannot deploy it to my phone. I also can't run the app in an emulator because if I choose the setting, VS does not change the caption and accept it. I don't have any more ideas.
If it helps I could provide my .sln file with all build configurations if desired. The only thing I did was checking out my source code to a new location on my hard drive. Since then I couldn't deploy anymore. Someone got any hints?
UPDATE:
I cannot deploy to my phone, run the app in an emulator or run the app in the simulator. The only thing that works is running on the local machine. Even all new apps I create cannot be deployed or run in an emulator or simulator. Visual Studio and SDK repair installation was made, no notable change.
If I load an old Windows Phone 8.1 RT or Silverlight project everything works normally, I can use the emulator and I can deploy it to the phone.
Right click your app in VS -> Properties -> Debugging
There is a combo box to select the target device. In my case there was no selection and I chose 'Device'. Now it works again.
https://dotblogs.com.tw/billchung/2016/04/03/051455

Error message: "ensure that the target device screen is unlocked" when using emulator

Anyone knows why I get the error message when debugging on emulator : "the application could not be launched for debugging. Ensure that the target device screen is unlocked and that the application is installed." while Developing in Visual Studio 2010.
I've Googled it through and try the solution, but still not fixed my problem.
Btw, my solution type is SLXNA so, there are 3 projects in there, the main project, lib project, and libcontent project.
What I've tried :
Set the main project as the startup project
Checked the build and deploy check box for the main project and checked the build checkbox for the lib project
Change active solution platform to Windows phone
Rebuild solution
But it's still didn't fixed the problem
But when I debug it on device, it runs smoothly
Anyone knows how to fix this?
Make sure that the project you want to run is set a default Startup
project
Make sure that in dropdown on top you have selected "Windows Phone
Emulator", not "Windows Phone Device"
And the most important is: click on an arrow pointing down near
the Debug/Release configuration and open Configuration Manager...
Make sure that the checkbox is checked in a column "Deploy" next
to your project name.
good news : i've solved this by simply installing the windows phone sdk 7.1.1
In case some WP8 developers stumble upon this:
I've seen the exact same error message on VS 2012 with a WP8 app. However, it worked when I switched to Visual Studio Express for Windows Phone (comes with the SDK).

Resources