I've installed a fresh copy of Visual Studio 2017 Community Edition on Windows 10 Pro Fall Creators Update recently, and I'm unable to properly create a new ContentPage on Xamarin.Forms (see screenshots 1-3). At my first attempt of creating a new ContentPage in a new Xamarin.Forms project, I encountered the errors seen on screenshot 1 and 2.
Next, an automated error log was generated (as attached). If I don't create any new items and run as-is, I can successfully launch the app on my Android emulator with no issues.
Exception of type 'System.Exception' was thrown
The project system has encountered an error.
Did not find new element in the hierarchy for item "Page2.xaml". The
item would have been added with type "Page". The project item
schema service knows about this item type. The item does exist
in the project file.
A diagnostic log has been written to the following location: "C:\..." (see below link)
Automatically generated error log file - txt
The issues arise when I create a new ContentPage. The code-behind .cs file and .xaml file will not be immediately visible in the Solution Explorer. I need to manually click the Show All Files button to show the newly created files (as seen in screenshot 3). However, I couldn't include them into project despite multiple tries.
When I open a .xaml file (in this case Page2.xaml), errors mentioning missing references and assemblies are visible (see screenshot 4 below).
I've done the following thus far:
Removed mobile app development (Xamarin) in the Visual Studio
installer
Reinstalled Xamarin by including (checking) the mobile app
development (Xamarin) in the Visual Studio installer
Are there any known solutions to this issue? Any assistance is kindly appreciated. Thanks!
UPDATE (Feb 27): Attempted recommendation by Paul-Jan but the issues still persist. However, the newly created Page1.xaml was properly included and recognized by Solution Explorer (as shown below).
I've had this happen with fresh VS2017 Professional installs where Universal Windows Platform (UWP) support was not added during install. Of course you might have no desire at all to develop for UWP, but apparently there are bits and pieces of the Xamarin Forms toolchain missing when you don't install it.
Running the Visual Studio Installer again, adding UWP support, helps.
Related
I'm trying to use WinUI (3) for the first time.
I've followed the instructions at https://learn.microsoft.com/en-us/windows/apps/winui/winui3/#install-winui-3-preview-4 so installed vs 2019 preview (Professional Version 16.9.0 Preview 4.0) and installed the "WinUI 3 Project Templates via the Manage Extensions option.
Created a new solution, added project type "Blank app, Packaged (WinUI in desktop)" (C#) and this is the result:
I can start debugging and the window opens and can click the example button without any issues.
But when I open the xaml I have this issue:
And the intellisense doesn't give options like for example grid.
The imported namespaces in the code behind:
So all the basics of a new WINUI project on a clean vs 2019 preview installation. I've only installed Resharper and imported my settings from my regular vs 2019 installation (which I reset but to no avail).
When I choose for Microsoft.UI.Xaml.Window he changes the xaml to
And gives following errors:
When choosing ABI.Microsoft.UI.Xaml.Window the xaml changes in the same way as before but also gives exceptions on other properties like "The property 'HorizontalAlignment' was not found in type 'StackPanel'".
No idea if this matters but as I've never worked with WPF I don't have experience with xaml (always worked with winforms as frontend). So I also added a WPF project to this solution and this worked without any issue.
I can't find anything regarding this so please help me set my first steps in WINUI.
I've notificed it worked for a few seconds after reopening my solution. So prime suspect was Resharper. Disabled it, and problem is solved. Re-enabled it, updated to 2020.3.2 and it worked.
So lesson here: It's not because you just installed Resharper, that it also downloads the latest version ...
My UWP app is building,rebuilding and deploying fine but it is not running.
Although, it works fine in other system.
I am using Visual Studio professional 2015 since 5 month to build this project and all of a sudden it has started showing this.
When i try to uninstall the app it doesn't give any option to uninstall also.
I have tried restarting the system and cleaning,rebuilding the project file but nothing seems to work.
Thanks in advance.
Causes:
It is a known issue in Visual Studio 2015.
For more info: unable to activate Windows Store app
Solution:
Update to Visual Studio 2017
For other solutions:
Unable to activate windows store app the app didn't start
Unable to activate Windows Store app: The App1.exe process started, but the activation request failed with error ‘The app didn’t start’
It seems like the directory or the folder were corrupted so that is why every time when i was running the application it was installing in a non packaged version therefore i was not getting the option to uninstall it properly.
I tried by deleting the whole folder which created in AppData folder of the Users but it didn't work.
So finally i created a new folder and moved my solution over there.And everything is working pretty much fine now.I thought we could solve this problem by repairing Visual Studio but since this issue is not related with Visual Studio and moreover it takes half of your day to repair Visual Studio so only moving the project to a newly created folder would be a good idea in this case.
I created a project and built it. It started showing error on MainActivity.cs on Resource.Layout.tabbar and toolbar. tabbar and tool bar error on MainActivity.cs
Then I changed the .FormsAppCompatActivity to .FormsApplicationActivity and then commented the tabbar and toolbar line of code and build.
tabbar and toolbar comment on MainActivity.cs
Then I build, that was when I saw this error:
The file “obj\Debug\android\bin\packaged_resources” does not exist. in visual studio 2015 xamarin cross platform on windows 8.1
The main project will build but the Andriod section won't build.
[Main project build successfully][3]
Fail to build App.Andriod
Please, I really need help because it's over a month and I have not solved the issue.
These errors can occur due to a number of reasons.
You have a resource in your Resources folder with a dash in it. e.g. '-'. These aren't valid and you should replace them with an underscore.
You aren't using the correct build tools. Open up the Android SDK Manager, and ensure you have the latest Platform Build Tools. Or at least the build tools that match the SDK you are compiling for.
If these points don't help, you will need to look at the detailed output during build to give you more of a hint. In Visual Studio, go to Tools > Options, then the Xamarin section.
Click on Android Settings, then set Output verbosity to Diagnostics.
When you try to build next, in the Output window, it will display a massive amount of detail, and the error that is occurring will be in there. It might take a little bit of sifting through to find out what is causing the error.
I am unable to build Windows Universal Apps in Visual Studio 2015. The application fails to start and shows this JIT debugger window:
There is a similair issue on StackOverflow that I cannot find but will continue to look for. One of the possible fixes was to switch to targeting 8.1 and then switch back, but I am unable to target 8.1 for any universal app.
Debugging the program reveals the following details:
Exception thrown at 0x7523DAD8 (KernelBase.dll) in APP_NAME.exe: 0x04242420 (parameters: 0x31415927, 0x558B0000, 0x004FF1D0).
Unhandled exception at 0x00007FFF60BB1F28 (KernelBase.dll) in WWAHost.exe: 0x00000004: The system cannot open the file (parameters: 0xFFFFFFFF80004005, 0x0000000000000005).
WWAHost.exe has triggered a breakpoint.
I think it has something to do with the WinMD file (specifically this line)
<Error Condition="'$(_TargetPlatformMetadataPath)' == ''" Text="Could not find an existing platform WinMD location" />
But I'm not sure how to set the _TargetPlatformMetadataPath or anything like that or where it would be set.
Here is an image as well, as you can see the application fails to load entirely and displays a big X instead of any actual content:
Here's what I've tried:
Restart and Repair Visual Studio 2015
Remove, restart, reinstall Visual Studio 2015
System restore (uninstall apps and reinstall Windows 10)
Clean & Build Remove compile directories (bin)
Create a new project
Download a project/template
Enable Windows 10 Developer Mode
There is no nuget package config file
I can build other project types without any issue, it seems to only be an issue with Universal apps. I should also note, this issue occurs if the project is brand new or if I've added content to the apps UI. The designer also fails with System.Runtime.Remoting.RemotingException or a System.Runtime.InteropServices.COMException seemingly randomly.
I have not been able to find any truly similar issues anywhere. I can select Universal App as a project type, but if I click compile it fails no matter what. I'm at my wits end here and am open to any suggestions, thanks everyone.
If nobody minds I'll post it like an answer (may be will be needed for someone else)
There was a bug in Windows 10 versions under Build 14295.
If you change default save location disk from C to another one in Settings - System - Storage - you will be not able to debug UWP apps in Visual Studio.
Upgrading system to latest should resolve the problem
I cannot add a solution reference to a portable class library to my Windows Phone 8.0 apps in Visual Studio 2012. When I try to add it by browsing to the .DLL, then it works. I receive this error when I try:
I am able to add a reference to the portable class library in my web service project, so the library itself appears to be OK.
I have tried:
Restarting Visual Studio.
Restarting Windows
Creating a new Windows Phone project
Creating a new portable class library
Repairing the Windows Phone 8 SDK
Repairing Visual Studio 2012
Regardless of what combination of those things I have tried, attempting to add a solution reference to a portable class library in a Windows Phone project gives me that error.
Well, it turns out that this error message was actually completely useless in what the issue actually was.
The issue was caused by a version mismatch between the PCL and Windows Phone project. I finally realized that VS 2012 only lets you target Windows Phone 8.0
for phone apps, and not 8.1, and I was selecting Windows Phone 8.1 as one of the target frameworks in my PCL. In order to allow me to add a solution reference to the PCL, I had to add "Windows Phone Silverlight 8.0" as one of the target frameworks. Now it works fine.
I have no idea why that error message is the one that I was receiving, but hopefully this can help someone else out if they run into it.
Problem in my case
I am not able to install Microsoft.EntityFrameworkCore.Tools package.
Every time I run the command inside Package Console it shows an error like this
Error
User canceled out of save dialog (Exception from HRESULT: 0x8004000C)
Solution
Restart Visual studio 2019 in admin mode.
Please make sure your project file is not locked.
You can check it by trying to edit the project file (.csproj file). If this file is locked, you cannot add the dependencies.
Tell the person who locked the file to check in or undo the project file and then try to add the dependency
Make sure you have saved any files that you have been working on before attempting this operation. I went to restart Visual Studio and it informed me that I had some pending saves. I saved, restarted and then was able to add the project reference.
Close the Visual Studio and open in run as Administrator .Then try to install the packages.I hope this will work.