The module 'appveyor-tools' could not be loaded

Lara's Avatar

Lara

04 Dec, 2019 09:40 PM

I am following the instructions in the page below to create a secure file:

https://www.appveyor.com/docs/how-to/secure-files/

The 1st step is no problem and I was able to download the secure-file utility via the PS command:

iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/appveyor/secure-file/master/install.ps1'))

These tools, btw, have been added to a folder in my project, which I am unhappy about and could indeed be the problem, given I do not know what I am doing. Darn.

The next command is the one failing to work:

appveyor-tools\secure-file -encrypt C:\path-to\filename-to-encrypt.ext -secret MYSECRET1234

Evidently, I changed the file path and password.

The error I get is:

appveyor-tools\secure-file : The module 'appveyor-tools' could not be loaded. For more information, run
'Import-Module appveyor-tools'.

I tried the suggested fix Import-Module appveyor-tools but got the error Import-Module : The specified module 'appveyor-tools' was not loaded because no valid module file was found in any module directory.

Any help would be most appreciated.

  1. Support Staff 1 Posted by Feodor Fitsner on 05 Dec, 2019 12:29 AM

    Feodor Fitsner's Avatar

    Could you please drop a snippet of your appveyor.yml with the commands above?

  2. 2 Posted by Lara on 05 Dec, 2019 02:07 AM

    Lara's Avatar

    Thank you for the quick reply.

    The project I was working on does not have appveyor.yml so there is that.

    I have tried with another project that does have it and it works.

    Thanks again.

    By the way, since I have your attention, is there a simple/fast way of preventing AppVeyor from doing an automatic build on certain commits?

    I find myself updating readme.md for example, and, well, there you go.

  3. Support Staff 3 Posted by Feodor Fitsner on 05 Dec, 2019 02:14 AM

    Feodor Fitsner's Avatar
  4. 4 Posted by Lara on 05 Dec, 2019 02:24 AM

    Lara's Avatar

    You are great, my friend. Good karma to you.

  5. 5 Posted by Lara on 05 Dec, 2019 05:13 AM

    Lara's Avatar

    Not quite finished, after all.

    The following error has me stuck.

    appveyor-tools\secure-file -decrypt .\Snippeter\larasqp.pfx.enc -secret %my_secret% -salt %my_salt%
    The system cannot find the path specified.
    Command exited with code 1
    

    The project setup and appveyor.yml files are at:

    https://github.com/LaraSQP/Snippeter

    https://github.com/LaraSQP/Snippeter/blob/master/appveyor.yml

    Sorry to be so thick.

  6. 6 Posted by Lara on 05 Dec, 2019 09:28 AM

    Lara's Avatar

    Many hours later, I found the solution to that problem. I thought the secure-file script was included already when it was not.

    Now, the problem is this:

    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3222,5): error MSB3325: Cannot import the following key file: larasqp.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_0B854036996BA9AC [C:\projects\snippeter\Snippeter\Snippeter_ibacx31x_wpftmp.csproj]
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3222,5): error MSB3321: Importing key file "larasqp.pfx" was canceled. [C:\projects\snippeter\Snippeter\Snippeter_ibacx31x_wpftmp.csproj]
    Command exited with code 1
    

    No idea what it means.

    Below is the report on the current build:

    https://ci.appveyor.com/project/LaraSQP/snippeter

  7. Support Staff 7 Posted by Feodor Fitsner on 05 Dec, 2019 07:54 PM

    Feodor Fitsner's Avatar

    If it's password-protected PFX then you should supply the password in a secure variable - I'm not only sure how it's passed down to msbuild when signing vsix packages. Usual approach is importing certificate into certificate store (either User or Machine) and then reference its thumbprint in a build. How do you do that locally?

  8. 8 Posted by Lara on 05 Dec, 2019 08:45 PM

    Lara's Avatar

    Locally, I create the PFX via VS. Just click on 'Sign the assembly', select 'New', provide a name/password and that's that.

    I assume it might then be automatically imported/stored somewhere somehow (perhaps c:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys) since I then use the same PFX file across projects and no passwords are required.

    As you can see, it is evident I know next to nothing about signing assemblies.

    But signed they become. On my machine.

    Regarding AppVeyor, I know how to produce the secure variable for the PFX password but, how would I include it in the appveyor.yml file?

    Again, thanks for your patience.

  9. Support Staff 9 Posted by Feodor Fitsner on 05 Dec, 2019 09:06 PM

    Feodor Fitsner's Avatar

    Looks like VsixSignTool might be used to sign vsix during the build.

    You can install it with nuget:

    nuget install Microsoft.VSSDK.Vsixsigntool -excludeversion
    

    and then use like:

    Microsoft.VSSDK.VsixSignTool\tools\vssdk\vsixsigntool.exe sign /f <certfile> /p <password> <VSIXfile>
    
  10. 10 Posted by Lara on 05 Dec, 2019 09:12 PM

    Lara's Avatar

    Err...

    How would that look in my appveyor.yml file?

    https://github.com/LaraSQP/Snippeter/blob/master/appveyor.yml

    Perhaps?

    build_script:
      - nuget install Microsoft.VSSDK.Vsixsigntool -excludeversion
      - nuget restore -Verbosity quiet
      - msbuild /p:configuration=Release /p:DeployExtension=false /p:ZipPackageCompressionLevel=normal /v:m
    

    I do not know what to do with the second command, I'm afraid.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

05 Dec, 2019 09:12 PM
04 Dec, 2019 07:46 PM
04 Dec, 2019 12:01 AM
04 Dec, 2019 12:00 AM
03 Dec, 2019 11:00 PM