How to Debug a VisualStudio Mac 2022 Extension?

296 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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>