Port Xamarin Android project to .net6.0-android - xamarin.android

I have a Xamarin Android Project that I want to migrate to .net6.0-android so I can use the new versions of MvvmCross. I have tried the upgrade-assistant. It claims to only upgrade Xamarin forms apps. I tried try-convert and it only seems to use msbuild through .net5.0. Can anyone tell me the correct steps to do this migration?
Thanks,
Jim

I wanted to maintain consistency in my Git Repository, so here is what I did. I made sure my app used the new PackageReference (to do this, if your project has a packages.config, you can right click it and it will give you an option to migrate). I created a blank .net6.0-android app. I copied the contents of my original app .proj to notepad to keep track of what NuGet packages I had been using. I then overwrote the contents of my original app .proj file with the contents of the blank app .proj. I used Nuget to add back in the required packages. I had to delete AssemblyInfo.cs in the Properties folder and Resource.Designer.cs in the Resources folder. I deleted the obj and bin folders in the project folder. After that, I was able to compile and run fine.

Related

Visual Studio for Mac - AppResource.Designer.cs Not Getting Regenerated

Visual Studio for Mac Community 7.7.4 (build 1)
I went info one of my .NETStandard 2.0 projects and added a string MyLabelTitle to its AppResources.resx file.
I reference this string in my code like so:
AppResource.MyLabelTitle
This will build successfully and that is great.
However, lots of online forums, documentations, Xamarin forums, StackOverflow questions that I have seen state that AppResource.Designer.cs file will regenerate itself when you rebuild your project. Some suggest ignoring it in git as well.
To test that, I reverted back my changes (I am using git) from AppResource.Designer.cs so the end result is that:
AppResource.Designer.cs does not have my changes while
AppResource.resx file has my change in it.
Based on my understanding, rebuilding the project will pick up my change from AppResource.resx file and add it to AppResource.Designer.cs file.
However, building my iOS or Android project will now fail to build because it is referencing one of strings I added in AppResource.resx file.
This string is still present in AppResource.resx file but it wasn't regenerated inside AppResource.Designer.cs and as a result my project is unable to reference that string.
UNSUCCESSFUL ATTEMPT TO SOLVE
I thought that if I comment out the line of code referencing AppResource.MyLabelTitle, I should be able to build successfully and it did build successfully, but the string MyLabelTitle still was not picked from AppResource.resx file and re-generated inside AppResource.Designer.cs file. As a result, I cannot reference that string anymore in my code.
How to resolve this issue?
I suspect you also posted this problem on the Visual Studio for Mac community forum but will answer it here in case anybody looks here instead.
Visual Studio for Mac does not re-generate the associated .cs files for .resx files when building. It will re-generate the .cs file when the .resx file is saved in the text editor.
One problem here is that the .resx file needs to have unsaved changes otherwise the .cs file will not be re-generated.
Android projects will re-generate their Resources.designer.cs file on building. This .cs file is generated based on the contents of the various .axml files in the project not any .resx files.
There is an addin you can install which might help here. It provides a way to run all custom tools for the solution or project manually or when a build is run.
https://github.com/mrward/monodevelop-run-custom-tool
https://addins.monodevelop.com/Project/Index/380

All the project files showing as Miscellaneous Files. Visual Studio 2017

I moved my Asp.net-mvc project from desktop to F drive and all the files are showing as miscellaneous files.
I've tried running the visual studio installer and modify to make sure that "Nuget targets and build tasks" are ticked.
I've also tried :
excluding the file
add existing member(adding the file again)
but nothing's working.
Same thing happened with my asp.net core web api when I moved it, it's working fine tho, getting data from server.
Hope you will solve your problem
Solution 1:
Create new project then paste all project contents in new created project.Restore Nuget packages then Build it.
Solution 2 :
Go to the file which are Miscellaneous inside Solution Explorer.
Right click those file'(s) and select Exclude from project.
Add Existing Item to project, you just excluded.
Probably your file property configuration is wrong.
Try this:
Right click over the File that has this problem
Click on Properties
Under Advanced -> Build Action, check if other than "Compile" is selected.
If so, change it to "Compile".
Properties Window

Should umbraco & umbraco_client be checked in to source control?

Just installed the latest Umbraco (7.2.1) package via NuGet. My development environment is as follows:
Umbraco is installed installed on IIS8 as shown below and is all up and running.
My Visual studio project is set up as shown below (For the sake of clarity, any folder/file excluded from project is not in included in my source control.
The content folder houses all scripts, images & css
On build - bin, config, content, masterpages, usercontrols, Views, xslt, default.aspx, Global.asax & the transformed Web.config are copied to the IIS instance (I don't like running Umbraco in the same place as my project, it just seems messy.)
Is this an appropriate way of developing for Umbraco? Am I missing anything, my biggest concern is whether or not I should include the umbraco & umbraco_client folders in version control and in the post build action. Any suggestions would be great.
There is some debate over what should and shouldn't be in your repository and ultimately it comes down to personal preference. I used to only add custom files and files that I changed from the Umbraco install such as the config files however since the introduction of the Nuget package I do put all but the binaries into source control because when I upgrade via Nuget later on I can easily see changes and merge customisations back in.
It saves a lot of hassle running Umbraco directly (IMO) especially if you make any changes via the UI and if you're not running it directly then there is little point really in using the Nuget package because you will end up with a bunch of unused files in your project. In your situation you might as well keep your project clean and do a manual install into the location IIS is using for the site and only keep files in your project that you have created.
This is only my opinion so take from it what you wish but hopefully it is of some help.
Simon

TFS - project lost from source control

I am having a problem trying to retreive a project from source control.
I have probably done the wrong thing removing bindings and so forth. The version of my project in source control is not the latest version.
I am wondering if it can be retreived from the SQL Server storage.
Alternatively is it possible to retreive it from converting back the live source code?
I shall try to explain what I did.
A project I have was in source control, but when I opened the project it was not locked. So I opened the project from source control, but it was an old project with the same name.
I tried unbinding the mapping, created a new workspace and extarcted to a new local folder. But I get the old project still.
I cannot find the latest version of the project.

.Net Build does not contain output folders from other projects

We had a Project in our solution called DatabaseCreation - which was responsible for creating the database and running the scripts (contained in directories within the project).
Everything was fine.
We then wanted to make the creation of this database to be available from an app and from a console, so re-factored so that we had ...
DatabaseCreation.Core
DatabaseCreation.App
DatabaseCreation.Console
Core has the directories containing scripts, and the App and Console run them.
When built with Visual Studio the directories containing the scripts are copied to the Output bin directory (either App or Console) but problem is: when the build server runs, the script directories don't get copied to the bin folder.
We've tried with TFS and Team City. I realise I could just copy them over, but its frustrating that it works when building in Visual Studio!
Can anyone put me on the right track please?
Check the Build Type for the files in the scripts directory. Find that by clicking one or many files (ctrl+click) then hitting properties (often f4). You likely want them to be content with Copy Always or Copy if newer.
The files were set to copy always, but the build just wouldn't pick them up.
The slightly awkward work around was to add the files as links from one project to another.
Add Existing -> navigate to other project - Looking for the little arrow on the right of the add button -> press that, Add as link option appears.

Resources