Skip to content

Commit fa32a73

Browse files
committed
Update to make plugin build on Win11, VS2026
I updated to a new Win11 machine, and v8.5 worked fine when I downloaded it, but it couldn't build it from source, likely because I'm now using Visual Studio 2026. Most of the changes in this commit are just importing code from NppCSharpPluginPack 0.0.3.26 (molsonkiko/NppCSharpPluginPack@8f8d0e0), since that plugin pack built fine on my new setup. The changes to Main.cs are just sorting the using's. The new UI test failures are likely due to EOLs being corrupted by Git when I pull from remote, since testfiles/small/example_ini.json is *supposed* to deliberately feature a mixture of CRLF and LF newlines, but Git likes to normalize newlines. I have used git config --global core.autocrlf false on this machine to try and prevent that from happening going forward. I will commit a change that fixes this issue shortly, but I wanted this commit to represent the minimal number of changes required to make the plugin compile on VS2026. Finally, the performance improvements are pretty obviously just due to a faster machine.
1 parent 2d700a0 commit fa32a73

10 files changed

Lines changed: 146 additions & 82 deletions

File tree

JsonToolsNppPlugin/JsonToolsNppPlugin.csproj

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<WarningLevel>4</WarningLevel>
2525
<PlatformTarget>x86</PlatformTarget>
2626
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
27+
<UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
2728
</PropertyGroup>
2829
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
2930
<DebugType>none</DebugType>
@@ -35,6 +36,7 @@
3536
<PlatformTarget>x86</PlatformTarget>
3637
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
3738
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
39+
<UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
3840
</PropertyGroup>
3941
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
4042
<DebugSymbols>true</DebugSymbols>
@@ -46,6 +48,7 @@
4648
<WarningLevel>4</WarningLevel>
4749
<PlatformTarget>x64</PlatformTarget>
4850
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
51+
<UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
4952
</PropertyGroup>
5053
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
5154
<DebugType>none</DebugType>
@@ -57,14 +60,25 @@
5760
<PlatformTarget>x64</PlatformTarget>
5861
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
5962
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
63+
<UseWinFormsOutOfProcDesigner>True</UseWinFormsOutOfProcDesigner>
6064
</PropertyGroup>
6165
<PropertyGroup>
6266
<!-- Default values for debugging so it start correct version of Notepad++
6367
$(ProgramW6432) and $(MSBuildProgramFiles32) points to the 64 and 32 bit "Program Files" directories -->
68+
<NppPath64 Condition="'$(NppPath64)' == ''">$(ProgramW6432)\Notepad++</NppPath64>
69+
<NppPath32 Condition="'$(NppPath32)' == ''">$(MSBuildProgramFiles32)\Notepad++</NppPath32>
6470
<StartAction>Program</StartAction>
65-
<StartProgram Condition="'$(Platform)'=='x64'">$(ProgramW6432)\Notepad++\notepad++.exe</StartProgram>
66-
<StartProgram Condition="'$(Platform)'=='x86'">$(MSBuildProgramFiles32)\Notepad++\notepad++.exe</StartProgram>
71+
<StartProgram Condition="'$(Platform)'=='x64'">$(NppPath64)\notepad++.exe</StartProgram>
72+
<StartProgram Condition="'$(Platform)'=='x86'">$(NppPath32)\notepad++.exe</StartProgram>
6773
</PropertyGroup>
74+
<PropertyGroup>
75+
<RestorePackagesPath>$(MSBuildProjectDirectory)\packages</RestorePackagesPath>
76+
</PropertyGroup>
77+
<ItemGroup>
78+
<PackageReference Include="UnmanagedExports.Repack.Upgrade" Version="1.2.1" GeneratePathProperty="true">
79+
<ExcludeAssets>all</ExcludeAssets>
80+
</PackageReference>
81+
</ItemGroup>
6882
<ItemGroup>
6983
<!-- infrastructure -->
7084
<Compile Include="Forms\AboutForm.cs">
@@ -272,14 +286,29 @@
272286
</ItemGroup>
273287
<ItemGroup />
274288
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
275-
<Import Project="$(MSBuildProjectDirectory)\PluginInfrastructure\DllExport\NppPlugin.DllExport.targets" />
276-
<Target Name="CopyTranslation" AfterTargets="Build" DependsOnTargets="Build">
289+
<Import Condition="Exists($(PkgUnmanagedExports_Repack_Upgrade))" Project="$(PkgUnmanagedExports_Repack_Upgrade)\build\UnmanagedExports.Repack.Upgrade.targets" />
290+
<Target Name="CopyBin" AfterTargets="Build" DependsOnTargets="Build">
291+
<!-- copy over the appropriate DLL, translation, and test files to the Notepad++ directory.
292+
Otherwise Notepad++ will just load without the plugin. -->
277293
<ItemGroup>
278-
<NPP32BIT Include="$(MSBuildProgramFiles32)\Notepad++\plugins\JsonTools" />
279-
<NPP64BIT Include="$(ProgramW6432)\Notepad++\plugins\JsonTools" />
294+
<RELEASE64 Include="bin\Release-x64\*.*" />
295+
<DEBUG64 Include="bin\Debug-x64\*.*" />
296+
<RELEASE32 Include="bin\Release\*.*" />
297+
<DEBUG32 Include="bin\Debug\*.*" />
298+
<NPP64BIT Include="$(NppPath64)\plugins\JsonTools" />
299+
<NPP32BIT Include="$(NppPath32)\plugins\JsonTools" />
280300
<TRANSLATION_ORIGIN Include="..\translation\*.json5" />
281-
<TRANSLATION32 Include="$(MSBuildProgramFiles32)\Notepad++\plugins\JsonTools\translation" />
282-
<TRANSLATION64 Include="$(ProgramW6432)\Notepad++\plugins\JsonTools\translation" />
301+
<TRANSLATION32 Include="$(NppPath32)\plugins\JsonTools\translation" />
302+
<TRANSLATION64 Include="$(NppPath64)\plugins\JsonTools\translation" />
303+
<TESTFILES_ORIGIN Include="..\testfiles\*.*" />
304+
<TESTFILES_ORIGIN_SMALL Include="..\testfiles\small\*.*" />
305+
<TESTFILES_ORIGIN_SUBSMALL Include="..\testfiles\small\subsmall\*.*" />
306+
<TESTFILES32 Include="$(NppPath32)\plugins\JsonTools\testfiles" />
307+
<TESTFILES32_SMALL Include="$(NppPath32)\plugins\JsonTools\testfiles\small" />
308+
<TESTFILES32_SUBSMALL Include="$(NppPath32)\plugins\JsonTools\testfiles\small\subsmall" />
309+
<TESTFILES64 Include="$(NppPath64)\plugins\JsonTools\testfiles" />
310+
<TESTFILES64_SMALL Include="$(NppPath64)\plugins\JsonTools\testfiles\small" />
311+
<TESTFILES64_SUBSMALL Include="$(NppPath64)\plugins\JsonTools\testfiles\small\subsmall" />
283312
</ItemGroup>
284313
<MakeDir Directories="@(NPP64BIT)" Condition=" '$(Platform)' == 'x64' " />
285314
<MakeDir Directories="@(NPP32BIT)" Condition=" '$(Platform)' == 'x86' " />
@@ -288,5 +317,23 @@
288317
<MakeDir Directories="@(TRANSLATION32)" Condition=" '$(Platform)' == 'x86' " />
289318
<Copy Condition=" '$(Platform)' == 'x64' " SourceFiles="@(TRANSLATION_ORIGIN)" DestinationFolder="@(TRANSLATION64)" SkipUnchangedFiles="true" />
290319
<Copy Condition=" '$(Platform)' == 'x86' " SourceFiles="@(TRANSLATION_ORIGIN)" DestinationFolder="@(TRANSLATION32)" SkipUnchangedFiles="true" />
320+
<!-- copy all test files to NPP plugin dir's subdirectory -->
321+
<MakeDir Directories="@(TESTFILES64)" Condition=" '$(Platform)' == 'x64' " />
322+
<MakeDir Directories="@(TESTFILES64_SMALL)" Condition=" '$(Platform)' == 'x64' " />
323+
<MakeDir Directories="@(TESTFILES64_SUBSMALL)" Condition=" '$(Platform)' == 'x64' " />
324+
<MakeDir Directories="@(TESTFILES32)" Condition=" '$(Platform)' == 'x86' " />
325+
<MakeDir Directories="@(TESTFILES32_SMALL)" Condition=" '$(Platform)' == 'x86' " />
326+
<MakeDir Directories="@(TESTFILES32_SUBSMALL)" Condition=" '$(Platform)' == 'x86' " />
327+
<Copy Condition=" '$(Platform)' == 'x64' " SourceFiles="@(TESTFILES_ORIGIN)" DestinationFolder="@(TESTFILES64)" SkipUnchangedFiles="true" />
328+
<Copy Condition=" '$(Platform)' == 'x64' " SourceFiles="@(TESTFILES_ORIGIN_SMALL)" DestinationFolder="@(TESTFILES64_SMALL)" SkipUnchangedFiles="true" />
329+
<Copy Condition=" '$(Platform)' == 'x64' " SourceFiles="@(TESTFILES_ORIGIN_SUBSMALL)" DestinationFolder="@(TESTFILES64_SUBSMALL)" SkipUnchangedFiles="true" />
330+
<Copy Condition=" '$(Platform)' == 'x86' " SourceFiles="@(TESTFILES_ORIGIN)" DestinationFolder="@(TESTFILES32)" SkipUnchangedFiles="true" />
331+
<Copy Condition=" '$(Platform)' == 'x86' " SourceFiles="@(TESTFILES_ORIGIN_SMALL)" DestinationFolder="@(TESTFILES32_SMALL)" SkipUnchangedFiles="true" />
332+
<Copy Condition=" '$(Platform)' == 'x86' " SourceFiles="@(TESTFILES_ORIGIN_SUBSMALL)" DestinationFolder="@(TESTFILES32_SUBSMALL)" SkipUnchangedFiles="true" />
333+
<!-- copy all files in current bin directory to NPP plugin dir -->
334+
<Copy SourceFiles="@(RELEASE64)" Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' " DestinationFolder="@(NPP64BIT)" SkipUnchangedFiles="true" />
335+
<Copy SourceFiles="@(RELEASE32)" Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' " DestinationFolder="@(NPP32BIT)" SkipUnchangedFiles="true" />
336+
<Copy SourceFiles="@(DEBUG64)" Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' " DestinationFolder="@(NPP64BIT)" SkipUnchangedFiles="true" />
337+
<Copy SourceFiles="@(DEBUG32)" Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' " DestinationFolder="@(NPP32BIT)" SkipUnchangedFiles="true" />
291338
</Target>
292339
</Project>

JsonToolsNppPlugin/Main.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
// NPP plugin platform for .Net v0.91.57 by Kasper B. Graversen etc.
2+
using JSON_Tools.Forms;
3+
using JSON_Tools.JSON_Tools;
4+
using JSON_Tools.Tests;
5+
using JSON_Tools.Utils;
6+
using Kbg.NppPluginNET.PluginInfrastructure;
27
using System;
38
using System.Collections.Generic;
4-
using System.Text;
5-
using System.Text.RegularExpressions;
69
using System.Diagnostics;
710
using System.Drawing;
8-
using System.IO;
9-
using System.Windows.Forms;
1011
using System.Drawing.Imaging;
11-
using System.Runtime.InteropServices;
12-
using Kbg.NppPluginNET.PluginInfrastructure;
13-
using JSON_Tools.JSON_Tools;
14-
using JSON_Tools.Utils;
15-
using JSON_Tools.Forms;
16-
using JSON_Tools.Tests;
12+
using System.IO;
1713
using System.Linq;
14+
using System.Reflection;
15+
using System.Runtime.InteropServices;
16+
using System.Text;
17+
using System.Text.RegularExpressions;
18+
using System.Windows.Forms;
1819
using PluginNetResources = JSON_Tools.Properties.Resources;
1920

2021
namespace Kbg.NppPluginNET
@@ -177,7 +178,7 @@ static internal void CommandMenuInit()
177178
}
178179
HideSelectionRememberingIndicators();
179180
}
180-
181+
181182
/// <summary>
182183
/// selection-remembering indicators should be hidden
183184
/// </summary>

JsonToolsNppPlugin/PluginInfrastructure/DllExport/DllExportAttribute.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,15 @@
22
using System;
33
using System.Runtime.InteropServices;
44

5-
namespace NppPlugin.DllExport
5+
namespace RGiesecke.DllExport
66
{
7+
/// <summary>
8+
/// The fully qualified type name must be <c>RGiesecke.DllExport.DllExportAttribute</c> in order to work with the pre-configured task in <c>UnmanagedExports.Repack.Upgrade.targets</c>.
9+
/// This implementation could be avoided if we referenced the <c>RGiesecke.DllExport.Metadata</c> assembly, but then it will look like a runtime dependency, and be copied to the build output directory.
10+
/// <para>
11+
/// See <seealso href="https://github.com/stevenengland/UnmanagedExports.Repack.Upgrade/blob/master/nuget/build/UnmanagedExports.Repack.Upgrade.targets"/>
12+
/// </para>
13+
/// </summary>
714
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
815
partial class DllExportAttribute : Attribute
916
{
-270 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

JsonToolsNppPlugin/PluginInfrastructure/UnmanagedExports.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
using System;
33
using System.Runtime.InteropServices;
44
using Kbg.NppPluginNET.PluginInfrastructure;
5-
using NppPlugin.DllExport;
5+
using RGiesecke.DllExport;
66

77
namespace Kbg.NppPluginNET
88
{
99
class UnmanagedExports
1010
{
11-
[DllExport(CallingConvention=CallingConvention.Cdecl)]
11+
[DllExport(CallingConvention = CallingConvention.Cdecl)]
1212
static bool isUnicode()
1313
{
1414
return true;
@@ -59,7 +59,7 @@ static void beNotified(IntPtr notifyCode)
5959
}
6060
else
6161
{
62-
Main.OnNotification(notification);
62+
Main.OnNotification(notification);
6363
}
6464
}
6565
}

JsonToolsNppPlugin/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@
2828
// Build Number
2929
// Revision
3030
//
31-
[assembly: AssemblyVersion("8.5.0.0")]
32-
[assembly: AssemblyFileVersion("8.5.0.0")]
31+
[assembly: AssemblyVersion("8.5.0.1")]
32+
[assembly: AssemblyFileVersion("8.5.0.1")]

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2022-2025 Mark Johnston Olson
190+
Copyright 2022-2026 Mark Johnston Olson
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)