nea / MarkdownViewerPlusPlus

A Notepad++ Plugin to view a Markdown file rendered on-the-fly
MIT License
1.19k stars 141 forks source link

0.8.1 build success on Visual Studio 2022 Community but getting ANSI Error when installing the plugin #161

Open bhu1st opened 5 months ago

bhu1st commented 5 months ago

Issue description

0.8.1 build success on Visual Studio 2022 Community but getting ANSI Error when installing the plugin

Following up on this: https://github.com/nea/MarkdownViewerPlusPlus/issues/70

I managed to get it work for the 0.8.1 branch with the following steps:

@monoblaine I was able to build version 0.8.1 in Visual Studio 2022 for x86 using PDFSharp 1.50.4000-beta3b as suggested by @DimitrijeK

Other packages: HtmlRenderer.Core -> 1.5.1-beta1 HtmlRenderer.PdfSharp -> 1.5.1-beta1 HtmlRenderer.WinForms -> 1.5.1-beta1

When copying the plugin files to Notepad++ 8.6.8 (x86) plugins folder I still get the same error "This ANSI plugin is not compatible with your Unicode Notepad++"

https://github.com/kbilsted/NotepadPlusPlusPluginPack.Net/issues/52 This mentions running "makerelease.ps1" for NotepadPlusPlusPluginPack.Net:0.94.00 but it seems like all the files in v0.8.1 are already UTF-8.

Also, on this Npp community thread, "C# Plugin Development and Error: This ANSI plugin is not compatible with your Unicode Notepad++" Paul Baker suggested changing the post-build tasks but I am lot at this.

Has anyone tried to build it recently? Any luck?

Environment

bhu1st commented 5 months ago

Version 0.8.2 build fine for Debug - Any CPU but getting following errors when building for x86 or x64

Rebuild started at 6:15 AM... 1>------ Rebuild All started: Project: MarkdownViewerPlusPlus, Configuration: Debug x64 ------ 1> Transitive merge 1> Merged assemblies: C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\MarkdownViewerPlusPlus\obj\x64\Debug\MarkdownViewerPlusPlus.dll;C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\packages\HtmlRenderer.Core.1.5.1-beta1\lib\net40-client\HtmlRenderer.dll;C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\packages\HtmlRenderer.PdfSharp.1.5.1-beta1\lib\net40-client\HtmlRenderer.PdfSharp.dll;C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\packages\HtmlRenderer.WinForms.1.5.1-beta1\lib\net40-client\HtmlRenderer.WinForms.dll;C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\packages\Markdig.0.15.0\lib\net40\Markdig.dll;C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\packages\PDFsharp.1.50.4000-beta3b\lib\net20\PdfSharp.Charting.dll;C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\packages\PDFsharp.1.50.4000-beta3b\lib\net20\PdfSharp.dll;C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\packages\Svg.2.3.0\lib\net35\Svg.dll; 1>C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\MarkdownViewerPlusPlus\MarkdownViewerPlusPlus.csproj(278,5): error MSB4062: The "NppPlugin.DllExport.MSBuild.DllExportTask" task could not be loaded from the assembly C:\Users\dell\Desktop\MarkdownViewerPlusPlus-0.8.2\MarkdownViewerPlusPlus\PluginInfrastructure\DllExport\NppPlugin.DllExport.MSBuild.dll. Could not load file or assembly 'Microsoft.Build.Utilities, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ========== ========== Rebuild completed at 6:15 AM and took 02.521 seconds ==========

bhu1st commented 5 months ago

If anyone wants to try building MarkdownViewerPlusPlus on Visual Studio 2022 Community check this out:

Open Legacy Projects (4.5 Framework) In Visual Studio 2022 https://www.c-sharpcorner.com/article/open-legacy-projects-4-5-framework-in-visual-studio-2022/

bhu1st commented 5 months ago

Another recommendation for ANSI issue:

NotePad++ Plugin - ANSI vs UNICODE https://www.reddit.com/r/programminghelp/comments/1254kdv/notepad_plugin_ansi_vs_unicode/

From the reddit post:

Moments after posting this, I was able to find a hint from the internet (even though what seems like 100s of previous searches were dead ends...). The dll that I was using took a string as an input. If I convert that string to UTF8, then it no longer is upset about UNICODE vs. ANSI. I do have other problems, but this issue seems to be resolved.

byte[] bytes = Encoding.Default.GetBytes(myString);
myString = Encoding.UTF8.GetString(bytes);
bhu1st commented 5 months ago

I was able to build 0.8.2 as well on Debug - Any CPU and Debug - x86 with the following settings:

The ANSI error is gone and the the build is successful. I tested installing the plugin and it works!