How to Debug a VisualStudio Mac 2022 Extension? - monodevelop

I've build a very simple .net6 library with a visual-studio-mac extension that adds a hello world kind of Pad.
How can I run/debug this project in a new instance of VSMac?

You have to add this ProjectTypeGuid to the project file so that the AddInMaker extension can add "Execute" to supported project features and create the execute command to run your extension.
<ProjectTypeGuids>{86F6BF2A-E449-4B3E-813B-9ACC37E5545F}</ProjectTypeGuids>
Although this allows to run your extension, it's not the correct solution for vsmac 2022.
For your extension to be fully compatible with the new version of visual studio, you need to reference the new libraries (17.x). To do this include the following in your .csproj:
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudioMac.Sdk" Version="17.0.0-preview.7955" />
<Reference Include="Xamarin.Mac">
<HintPath>\Applications\Visual Studio %28Preview%29.app\Contents\MonoBundle\Xamarin.Mac.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>

Related

TKCustomMap Version Conflict

This issue has been reported on GitHub here -
https://github.com/TorbenK/TK.CustomMap/issues/325
Has anyone else has struggled with this? I was stoked to find this nuget package because it does exactly what I'm looking for but it needs Places and some other GooglePlayServices installed and I can't install them because of this conflict.
I'm also not sure if uninstalling TK.CustomMap and then installing the Play Services would even help because the person who reported the issue on GitHub said-
I converted my app to .net 2.0 and had to use the newest Google play services
60.1142.1 for AdMob to work. It wouldn't install until I uninstalled TK.CustomMap, and now TK.CustomMap won't reinstall because it only want to use GooglePlayServices 42.1021.1
Severity Code Description Project File Line Suppression State
Error NU1107 Version conflict detected for Xamarin.GooglePlayServices.Tasks. Reference the package directly from the project to resolve this issue.
HunterTracker.Android -> Xamarin.GooglePlayServices.Base 60.1142.1 -> Xamarin.GooglePlayServices.Tasks (= 60.1142.1)
HunterTracker.Android -> HunterTracker -> TK.CustomMap 2.0.1 -> Xamarin.GooglePlayServices.Location 42.1021.1 -> Xamarin.GooglePlayServices.Tasks (= 42.1021.1).
That's pretty much the exact error I'm getting trying to install the other packages. There's no resolution on github.
Anybody found a work around? Or does anyone know how to "Reference the package directly from the project"?
Thanks to SushiHangover's comments above pointing me in the right direction I was able to discover what I needed to do here. I had an error updating the nuget packages of TK.CustomMap at first because v26 Xamarin.Android.Support.Vector.Drawable was targeting MonoAndroid8.0 and the update to v27 must target MonoAndroid8.1 So it took quite a bit just to be able to update the nuget packages in order to get the assemblies with later versions so I could use TK.CustomMap in my solution. But I was eventually able to get there. Here were the steps I followed (as best I can remember). I am unable to compile ios right now because I don't have a MAC so that fix will have to come later. This fix is for the shared project and Android project only
Download the TK.CustomMap-master from github
Extract it and delete the Sample project completely (I also deleted the UWP project as I'm not really interested in that at this time)
Opened and built then closed. Deleted packages folder, vs folder, bin and obj from Android and Shared Project (this step is probably not necessary but I did it so...)
In the packages.config in Android changed all targets from monoandroid80 to monoandroid81 save file
In the TK.CustomMap.Android.csproj for every v26.0.1 of any Xamarin.Android.Support or other Xamarin.Android util package changed 26.0.1\lib\MonoAndroid80 to 27.0.2.1\lib\MonoAndroid81 - save file
In the nuget folder in TK.CustomMap.nuspec changed the target framework in this section
<group targetFramework="lib\MonoAndroid7.0">
<dependency id="Xamarin.GooglePlayServices.Location" version="42.1021.1" />
<dependency id="Xamarin.GooglePlayServices.Places" version="42.1021.1" />
<dependency id="Xamarin.Android.Maps.Utils" version="0.5.0" />
<dependency id="Xamarin.Forms" version="2.5.0.91635" />
<dependency id="Newtonsoft.Json" version="10.0.3" />
</group>
to
<group targetFramework="lib\MonoAndroid">
so it could target any version
Opened and updated all nuget packages using package manager (not console). Built debug and release builds
At this point opened solution I had tried to implement TK.CustomMap in previously to attempt the fix. Remember the original issues was that the latest frameworks could not be used and 42.1021.1 frameworks were unable to locate com.google.gms.location and com.google.gms.places.ui files so they had to be updated or no TK.CustomMap
In the problem solution uninstalled TK.CustomMap from all projects
In the problem solution Android project added reference to all the dlls in the release folder of the Android bin file from TK.CustomMap project.
Installed updates for all Xamarin.Android frameworks in problem solution through Package Manager (not console)
Installed updates of all other nuget packages for all projects using Package Manager (not console)
Installed TK.CustomMap to Shared project using Package Manager (not console)
Added the References to the android project a second time. May or may not have helped.
Installed TK.CustomMap Nuget Package using Package Manager (not console)
Built and ran on Live Player successfully!!
Thanks to Sushi Hangover for the advice. I haven't seen any comprehensive tutorials anywhere on how to accomplish this so I figured I would post my own answer in case anyone else was looking. Definitely if you are new to VS all this stuff is no walk in the park in the beginning.
Thanks to #Travis Fleenor. This is my solution. I change a bit your sequence in order to work on mine.
1. Make sure the original proyect from github (https://github.com/TorbenK/TK.CustomMap) works and you can run it.
2. Update the nugets where you get the conflict. In my case I got conflicted in googleplay library version. I updated it in the original proyect and then assure it could run it.
3. Compile entire solution in release mode. Then, copied the generated dll from bin/release and pasted them in a folder in my desktop.
4. I referenced those dll to shared proyect and android proyect. I only used nuget package manager to install some missing packages needed for the tk.custom. Notice that you only will reference some dll that the proyect accept. For the mayority Visual will prompt ' dll already referenced' something.
5. first reference your shared proyect, later your android one. That's all. make sure the you ca recompile solution.
Hope this helps

Unable to find provider assembly with name MySql.Data.EntityFrameworkCore

I have created a new project based on mvc core 2.0 on Framework 4.6.x.
I want to do dbFirst with MySql DataBase.
I followed the steps that define the MySql official website.
Scaffolding to Database Using Package Manager Console in Visual Studio.
https://dev.mysql.com/doc/connector-net/en/connector-net-entityframework-core-scaffold-example.html
Once all the steps have been executed I have executed the Scaffold-DbContext in the Package Manager Console
After a few seconds, the following error occurs:
Unable to find provider assembly with name MySql.Data.EntityFrameworkCore. Ensure the specified name is correct and referenced by the project.
I have seen solutions for SQLServer but not for MySql.
Thank you.
I was getting the same problem and my solution was:
Set startup project (should not be a library project type) and target project, then make sure I have already install all of the packages.
For MySQL I was using Pomelo.EntityFrameworkCore.MySql
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.2" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql.Design" Version="1.1.2" />
This command to generate the database dotnet ef dbcontext
dotnet ef dbcontext scaffold "server=localhost;port=3306;user=root;password=password;database=dbname;" Pomelo.EntityFrameworkCore.MySql -o Models -p targetproject -s startup project
You just need to install package
Install-Package MySql.Data.EntityFrameworkCore -Version 8.0.13
When wrestling with tooling, there can be a variety of issues. In my case, I was attempting to reverse-engineer into a .NET Standard Class Library project. This is not supported. I had not yet set the library as a dependency to another project.
If this is your situation: reference the class library from an executable project. Reference the executable project from Scaffold-DbContext (using -Project or setting it as the default) and it should run. By default it will generate the code files into the executable project, so you should use the other switches as needed, or you can just copy them over and change the namespaces as necessary.

Locally deploy parallel versions of a Windows Store App

I am developing a Windows Store App and I like to keep the most recent baseline installed while developing the next.
The problem is that whenever I run the current developmental version in Visual Studio 2013 (with F5) it un-installs the recent baseline.
I create and install a baseline by manually editing the Package.appxmanifest as follows:
edit the Identity Name
Append .R to every instance of the app name (eg. MyApp to MyApp.R)
(full file listing below)
I think that should be enough, but in my vain attempts to get this working I have also, in the project properties, append .R to the Assembly name, eg. MyApp.R, and changed one number in the MyApp_TemporaryKey.pfx
Then, when I run the app (F5) it is installed as MyApp.R, and persists and can be used outside Visual Studio.
The problem is that when I undo these changes to resume development, and run it again as MyApp then MyApp.R is uninstalled, and I am left with only the latest version, ie. MyApp.
I know that this is achievable because I have done it once before. I didn't record exactly what I did that time, because it didn't seem too hard, but after hours of trying I can't do it again. Either I haven't reproduced the steps correctly, or something has changed in Windows 8.1 since I last did it.
Why does Windows think the two versions are the same App? Is there another identity or key which I haven't changed?
Package.appxmanifest:
<?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
<!--<Identity Name="8086b500-65af-4dd4-a67b-923c43472921" Publisher="CN=joedev_000" Version="1.0.0.0" />-->
<Identity Name="11111111-65af-4dd4-a67b-923c43472930" Publisher="CN=joedev_000" Version="1.0.0.0" />
<Properties>
<DisplayName>MyApp.R</DisplayName>
<PublisherDisplayName>joedev_000</PublisherDisplayName>
<Logo>Assets\StoreLogo.50x50.png</Logo>
</Properties>
<Prerequisites>
<OSMinVersion>6.3.0</OSMinVersion>
<OSMaxVersionTested>6.3.0</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="x-generate" />
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="MyApp.R.App">
<m2:VisualElements DisplayName="MyApp.R" Square150x150Logo="Assets\SquareLogo.150x150.png" Square30x30Logo="SquareLogo.30x30.png" Description="MyApp.R" ForegroundText="light" BackgroundColor="#464646">
<m2:DefaultTile Square70x70Logo="SquareLogo.70x70.png" Square310x310Logo="SquareLogo.310x310.png" Wide310x150Logo="WideLogo.310x150.png" ShortName="MyApp.R" DefaultSize="square150x150Logo">
<m2:ShowNameOnTiles>
<m2:ShowOn Tile="square150x150Logo" />
</m2:ShowNameOnTiles>
</m2:DefaultTile>
<m2:SplashScreen Image="Assets\SplashScreen.620x300.png" />
</m2:VisualElements>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
</Capabilities>
</Package>
The Identify in the Manifest is the important part (in the visual manifest editor this is the "Package Name"). Changing the Identity is sufficient to allow both versions to be installed. You can also change the Identity to something meaningful rather than a GUID.
As you note, Visual Studio will uninstall the old version it has staged for you, but you can create a deployment package and install it again yourself.
When you are ready to switch to a new baseline use the Project.Store.Create App Packages... menu to create a development test package (i.e. not to upload to the store).
Update your manifest to use the new Identity. Changing the display names is not technically necessary but will make things less confusing.
Building this will install the new version and remove the staged version.
Now install the development package you created: go to AppPackages folder and run the Add-AppDevPackage.ps1 for the older version you want to reinstall.
You will end up with a normally deployed (in Program Files\WindowsApps) developer package of the old version and a staged (in your VS project directory) package of the new version.
(Alternatively, you can shuffle the versions to rename the old version to indicate it's old, create an app package for the renamed version, re-rename the Identity back to the original, and then install the dev-package for the old renamed version).
Try this if it works... Worked for me
Run the baseline application
Create a new working folder (or branch if you are using a code repository like TFS)
Eg : VS 2013 -> Projects -> App 1 then create VS 2013 -> Projects -> App 1-Copy
Change the Package Name in Package.appxmanifest under packaging tab in the new working copy
something which will be unique like changing the last couple of digits (to make a distinction between both the apps you can change the display name under Application tab and package display name under Packaging Tab)
and run the new application
this will list both your baseline and your development version
Hope this helps

Enabling Ant Tools in a new Eclipse Galileo installation

I have recently installed Eclipse Galileo with the PHP Developers Tools. I plan to install the Flash Builder 4 Plug-in to do ActionScript development as well.
I want to use Eclipse to both create an ant build script and execute it to compile ActionScript docs from an ActionScript 3 code library.
The problem is that when I try to run a build.xml file (which every site that answers the ant build questions says it should handle automatically) I never see an option to run it as an Ant Build, not can I find any way to associate XML files to Ant in the Preferences or External Tools dialogs.
I;ve seen numerous tutorials on build Ant build files, but never anything about running the actual build script.
Try to install "Eclipse Java EE Developer Tools" component. It's in "Web, XML, and Java EE Development" of "Galileo - http://download.eclipse.org/releases/galileo" repository.

How can I reverse-engineer an installer that was written with ghost-installer?

I have an installer for which I don't have any source code. I need to either "wrap" this installer or edit it to add a few more files. What's the best way to do this? As the title mentions, the installer was written w/ ghost installer.
Since it's not an MSI, you can't use Orca to edit the installer itself. And I have written custom install actions before as well for my MSI installers.
Since you don't have much control (if any) over your Ghost Installer, I would perhaps write a custom executable to supplement the installer, that can either run before or after the installer. This will create a few extra files to distribute to your customers, but you can distribute the entirety as a zip archive.
First of all, if you want to create an unmanaged bootstrapper the same way Visual Studio does to ensure prerequisites are installed, you can do it through MSBuild with a script like the following:
<Project ToolsVersion="3.5" DefaultTargets="BuildBootstrapper" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<BootstrapperFile Include="Microsoft.Net.Framework.2.0">
<ProductName>Microsoft .NET Framework 2.0</ProductName>
</BootstrapperFile>
</ItemGroup>
<Target Name="BuildBootstrapper">
<GenerateBootstrapper
ApplicationFile="CustomInstallerExecutable.exe"
ApplicationName="Pretty Title of Application Goes Here"
BootstrapperItems="#(BootstrapperFile)"
ComponentsLocation="Relative" />
</Target>
</Project>
This will produce a "setup.exe," which is the de facto file name for any bootstrapper of an installer. In fact, if you wanted to ensure the user didn't accidentally skip the bootstrapper and go straight to the installer, you could hide the Ghost Installer in a "bin" folder or something away from the root of the zip archive. That way, their only intuitive option is the "setup.exe." Include a "README.txt" as well if you need to be extremely clear for the customer's sake.
What this bootstrapper also does is make sure the client has the .NET 2.0 Framework as a prerequisite so that your "CustomInstallerExecutable.exe" can be written in .NET and not in an unmanaged language. In fact, this MSBuild script will plop down the .NET 2.0 Framework installer right beside your newly create bootstrapper (because of the "Relative" value of the "ComponentsLocation" attribute). There are other attribute values you can use that will facilitate the user getting the .NET Framework over the Web instead, if you are concerned about bloating the original download size of your Ghost Installer download to your customers.
Now your "CustomInstallerExecutable.exe" (written in beautiful, managed C#) can drop the extra files down on the machine before (or after) running the Ghost Installer. I have previously written some code to run an MSI from a .NET executable:
string msiString = "blahBlah.msi";
// Kick off Update installer
ProcessStartInfo startInfo = new ProcessStartInfo(
"cmd.exe",
"/c start /wait msiexec.exe /i " + msiString);
startInfo.WorkingDirectory = "bin";
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
Process process = new Process
{
StartInfo = startInfo,
EnableRaisingEvents = true
};
process.Exited += new EventHandler(process_Exited);
process.Start();
I think you could do something very similar to call your Ghost Installer instead of an MSI. If you are running this .NET executable before the Ghost Installer, you can just invoke the Ghost Installer process and then exit your "CustomInstallerExecutable.exe" process and not wait for the process.Exited event to fire. This event waiting would be more for running "after install" logic.
Good luck and hope this is helpful.