Weird issues with multiple C# plugin projects, debugging goes to different project



  • The past few weeks I’ve created three different C# plugin projects for testing and trying things out. But now I encounter a weird problem when debugging the newest project.

    I’ve installed the template in .\Documents\Visual Studio 2019\Templates\ProjectTemplates\Visual C#\NppPlugin0.95.00.zip and then create a new project based on that template.

    Btw an aside note; in the Visual Studio create new project window, using the text search I can’t find a “notepad” or “NPP” template. Only when I clear all three filters (All Languages, All Platforms, All Project Types) only then the template shows at the bottom of the list.

    But anyway when I debug the Main.cs of my most recent project, Visual Studio somehow goes to the Main.cs of my very first project, and that other project wasn’t even opened in Visual Studio. I suspect that maybe it has to do with this line in AssemblyInfo.cs

    // The following GUID is for the ID of the typelib if this project is exposed to COM
    [assembly: Guid("31492674-6fe0-485c-91f0-2e17244588ff")]
    

    Am I correct in assuming this needs to be changed to a random unique Guid for every new project? If so, is it possible to automate this from the template somehow?

    Still, after I change the Guid the problem still occurs. It might also be a Namespace related issue, because the Main.cs uses the namespace Kbg.NppPluginNET from the template, but the default namespace (Project Properties -> Application -> Default namespaces) is set to the project name.

    Any ideas on how to solve this debugging issue?



  • (why can’t I edit my post after three minutes?) Anyway I forgot to mention that when debugging the Stack Frame dropdownlist also shows this other project:

    CSVLint.dll!Kgb.NppPluginNET.Main.CommandMenuInit() Line 39
    CSVLint.dll!Kgb.NppPluginNET.Main.UnmanagedExports.setInfo(Kgb.NppPluginNET.PluginInfrastructure.NppData notepadPlusData line 21)
    


  • @Bas-de-Reuver

    The mentioned GUID is relevant for projects that create COM objects.
    In this case it MUST have a unique ID, but as far as I understand the C# template, this is not something that is exported by default.
    Namespaces must be unique per project and are basically the upper hierarchy of classes used.

    The part that I suspect is the problem, please keep in mind. that I am not a C# developer, is the assembly manifests.
    My understanding is that these define how the assembly is loaded into the Global Assembly Cache.



  • @Bas-de-Reuver said in Weird issues with multiple C# plugin projects, debugging goes to different project:

    why can’t I edit my post after three minutes?

    Because those are the rules here.


Log in to reply