Help with Appveyor Plugin Build (C#)



  • Hi,
    Just wondering if someone could be kind enough to help me out and show me what I’m doing wrong.
    I’m trying to setup AppVeyor to build my plugin (written in c#), and the build succeeds, but the artifacts don’t work in Notepad++. When I run the commands locally, it works perfectly.

    The build can be found at
    https://ci.appveyor.com/project/cpmcgrath/codealignment/build/14.0.63
    and it’s building off a test branch:
    https://github.com/cpmcgrath/codealignment/tree/test/appveyortest

    My best guess is it’s something to do with
    https://github.com/cpmcgrath/codealignment/blob/test/appveyortest/DllExport/NppPlugin.DllExport.targets

    Thanks in advance!



  • @cpmcgrath
    Downloaded both Npp artifacts, x86 archive does not open as a zip or a 7z file, x64 archive opens just fine. Installed x64 plugin, tried some alignments (examples taken from the website), seams to works just fine.

    Notepad++ v7.5.4   (64-bit)
    Build time : Jan  1 2018 - 01:50:29
    Path : C:\Program Files\Notepad++\Notepad++.exe
    Admin mode : OFF
    Local Conf mode : OFF
    OS : Windows 10 (64-bit)
    Plugins : CodeAlignmentNpp.dll ComparePlugin_64.dll DoxyIt_64.dll DSpellCheck_64.dll Exec_64.dll JSMinNPP_64.dll LuaScript_64.dll MarkdownViewerPlusPlus_64.dll PluginManager_64.dll SurroundSelection_64.dll XMLTools_64.dll 
    


  • Strange, both zips download fine for me. I just tested the x64 one again on a different computer and got the same error I was getting before. I’ve got 7.5.4 x64 too.

    C:\Program Files\Notepad++\plugins\CodeAlignmentNpp.dll

    Failed to load

    CodeAlignmentNpp.dll is not compatible with the current version of Notepad++.

    Do you want to remove this plugin from the plugins directory to prevent this message from the next launch?



  • @cpmcgrath
    Retry of download of x86 archive succeeded and installed plugin seems to function fine.
    Really strange.



  • The download from https://ci.appveyor.com/project/cpmcgrath/codealignment/build/14.0.63 is working fine also for me now with N++ 7.5.4. I think there was an issue in the communication with the plugins fixed, see https://notepad-plus-plus.org/download/v7.5.4.html:

    Fix a crash bug due to disordered notifications sent to plugins.



  • I just downloaded the portable zips for x86 and x64, and installed the plugins both still don’t work for me.
    Is there an error log I can check out which would have more information in it? I couldn’t find any details of anything like that.

    Also thanks for all the help, it’s really appreciated.



  • Okay, I’ve figured out a bit more. CodeAlignmentNpp.dll where I assumed the problem was is fine. I use that one with the common dlls I built locally and we’re hunky dory. The problem is with CodeAlignment.Common.dll. For various reasons, I’m guessing this is classic git new line handling - my computer would be set to \r\n, while appveyor is set to just \n.

    No idea why the result works for both of you but not for me.

    Thanks again for all the help.

    P.S. If anyone knows how to change this in AppVeyor it would be appreciated.



  • In appveyor.yml this one:

    init:
    - git config --global core.autocrlf true

    might help in this case.



  • See https://ci.appveyor.com/project/chcg/codealignment/build/14.0.12, but that seems to not fix the issue.



  • Thanks, I’ve figured it out. Basically it’s a security problem.
    For anyone interested here’s some further details:

    System.IO.FileLoadException: Could not load file or assembly ‘CodeAlignment.Common, Version=14.0.0.19412, Culture=neutral, PublicKeyToken=ef66090a528beee6’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

    File name: ‘CodeAlignment.Common, Version=14.0.0.19412, Culture=neutral, PublicKeyToken=ef66090a528beee6’ —> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
    at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
    at System.Reflection.Assembly.LoadFile(String path)
    at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

    When you go into CodeAlignment.Common.dll’s properties you can click “Unblock” which fixes it. But I’m going to investigate the loadFromRemoteSources switch it mentions



  • I just retested and could confirm that. After unblocking the downloaded appveyor files are also functional.


Log in to reply