Xamarin.Forms upgraded to Maui - Visual Studio Cannot debug/run? - xamarin.forms

Application upgraded using Microsoft's auto upgrade command line tool.
Some code fixes, and the code builds successfully.
Visual Studio however does not show me any way to debug my app.
When trying to click on Debug anyway, a random Android Emulator from my list(which is not showing currently)
Will open, but deployment will fail without specifying the reason.
Has anyone managed to upgrade an existing Xamarin.Forms project to Maui?

I managed to make VS recognize the Android project in my converted solution.
I added the <SingleProject>true</SingleProject> property into my Android project's .csproj file under the first/main property group, closed VS, deleted Bin, Obj, .vs folders.
After starting VS again , I rebuilt and VS allowed me to debug on selected .net targets like a single project Maui solution.
This is very strange that it works, since this solution is made of 3 project like in a Xamarin.Forms solution, so it doesn't make since that adding this property solves the issue, but there you go.

Delete .bin and .obj folders. Delete solution's hidden .vs folder. Build. Does it show debug option now?
Try restarting VS (after the successful build). Now work?
If not, Create a new project using Maui template.
Use solution / manage all nugets to add nugets used by your project.
Copy all your source files into that new project.
Project / "Add existing items": all those source files.

Related

XamarinForms CustomRenderer with .net standard 2.0 and prism7

I am trying out Prism7 together with AutoFac in a xamarinforms project.
I am trying to create a custom renderer for an entry control, nothing fancy here.
But for some reason i cannot get a reference to xamarin.forms and xamarin.forms.platform.ios/android namespaces in my ios and android project.
The project is based on the prism7 templates and the pcl is a .net 2.0
Normally I would expect
[assembly: ExportRenderer(typeof(Entry), typeof(BorderlessEntryRenderer))]
to work and connect my renderers but as said cannot reference xamarin.forms.
Anyone got an ideer?
I made it work.
Solution was to open project in Visual Studio Mac (I was in pc version before).
Then there is no problem seeing the namespaces. Rebuild and run both projects to see them work.
Go back to visual studio pc version and continue work there. If you have Resharper you need to clear cache otherwise it will look like you still have errors.
Must be a Visual Studio Pc or Resharper bug. Maybe I should use Mac version from now on :-)
I had the same problem. That's how I fixed it:
Add the correct references (ex: using myproject.myrenderers;)
Close the solution and Visual Studio (Windows).
Delete all bin and obj folders in the solution (including each platform).
Open VS and the project.
Clean.
Rebuild.
Done.

Visual Studio App Center - Duplicate 'EmbeddedResource' items were included when building Xamarin Forms app?

When building a Xamarin Forms app in Visual Studio App Center it complains about the embedded xaml-files when using netstandard2.0.
Locally with updated Visual Studio and Xamarin Forms it works perfect to build and run.
(CheckForDuplicateItems target) ->
/usr/local/share/dotnet/sdk/2.0.3/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Sdk.DefaultItems.targets(276,5):
error : Duplicate 'EmbeddedResource' items were included. The .NET SDK
includes 'EmbeddedResource' items from your project directory by
default. You can either remove these items from your project file, or
set the 'EnableDefaultEmbeddedResourceItems' property to 'false' if
you want to explicitly include them in your project file. For more
information, see https://aka.ms/sdkimplicititems.
How should xaml-files be added to the project if not as embedded?
UPDATE:
The same error is present using VSTS and Hosted Mac Agent
Edit your .csproj file and remove the ItemGroup that contains the EmbeddedResource.
This resolved the issue from me but the original answer came from Xamarin Forums

My Visual Studio ASP.NET Project Keeps Adding A Release Configuration After I Delete It

I have a Visual Studio 2015 solution that contains a ASP.NET MVC 5.2.3 project. Within the configuration manager, I have removed the default Debug and Release configurations for both the solution and project and replaced them with 3 configurations of my own, none of which are named Debug nor Release. Every time I reopen the solution, I repeatedly see a Release configuration added to the ASP.NET MVC project, even after attempting to delete it several times and verifying that it doesn't exist in the raw markup of the .sln and .csproj files. The Release configuration also appears to be blank.
Is this a known bug with Visual Studio? Is there a way to fix this?

Visual Studio 2015 codelens issues when using Typescript

I'm using Visual Studio 2015 Enterprise RTM.
When creating an ASP.net 4.6 web application using the Web Api template, I noticed as soon as I add a TypeScript file, the codelens indicators stop working.
I tested this on a new installation, with no extra extensions installed, as well and tried other asp.net 4.6 templates.
When running in safe mode the problem doesn't occur.
Steps to reproduce:
Set the framework to 4.6
Create a web application by using the web api template.
Change authentication to no authentication
Open the webapiconfig.cs in App_Start
The codelens indicator on the register method should say: 1 reference
Add a typescript file called app.ts (doesn't really matter) in the scripts folder, tit may remain empty
The codelens indicator in the webapiconfig file should still say 1 reference
Close Visual Studio
Reopen Visual Studio and open the solution
Check the webapiconfig file, the codelens doesn't show references anymore or on any other file
Any idea on how to debug codelens or does anyone have this problem as well?
I work for the visual studio team that is responsible for codelens references indicators. I can confirm that this is indeed a bug in VS2015 where codelens references stop working when you add typescript files to your project or typescript projects to your solution :( Unfortunately, we missed this bug for RTM. We're currently actively investigating this bug. At the moment, I am not aware of any workarounds for this problem. I can post an update when we have more information to share on this bug.
I may have found a workaround that seems to do the trick for me:
So, I have a solution with multiple projects, only one of which has TypeScript files.
I just unloaded the project, cleaned + rebuilt (some restart to Visual Studio at this point may help + close all opened files), then loaded again, cleaned and rebuilt and now CodeLens shows my references (again, close all open files).
Note that until this bug is fixed, you may have to do this each time you open VS.
Hope this helps!
EDIT: If you only have a single project, then exclude the Scripts folder from the solution, clean, rebuilt, close Visual Studio then open it again. Now you should have the references back. Simply include the folder again.
Best of luck!
in my case references start working after uninstalling vssonar extension, vs2015ent

where to find cordova.js in the visual studio 2015 hybrid app

I have installed VS 2015 preview. I am trying to use the Hybrid App javascript template to create a new project. But I do not see any cordova.js in the project. Trying to learn following the sample given here [ http://msdn.microsoft.com/en-us/library/dn832630.aspx ] it refers to referencing the cordova.js file from root of the project. But there is no such file visible. Nor are there any instructions to explicitly import it. What am I missing?
The application does build and show up in Ripple OK. But i am trying to figure out where does cordova.js file reside.
Thanks.
Cordova.js is added at the build time, after you build the project, you can find the cordova.js at \bld\Ripple\Android\Debug or \bld\Debug\platforms\android\assets\www (in case of Android similarly for different platform).
Therefore when you add reference to cordova.js in index.html, it is picked at run time. That's the reason your app is running fine even though Cordova.js is not present in Visual Studio project directory.

Resources