Build Office Adding Project fails

ricardo.polo's Avatar

ricardo.polo

22 Oct, 2014 05:29 AM

Hello.

I have a Visual Studio solution with multiple projects, Websites, Console Applications, etc.
One of the projects is an Outlook AddIn.

When the solution is build by AppVeyor it fails. On our developer computers it works perfectly.

This is what we see in the Build Log
C:\projects\signtul\Tulpep.Singtul.OutlookAddin\Tulpep.Signtul.OutlookAddin.csproj(260,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Command exited with code 1

How could we fix it?

  1. Support Staff 1 Posted by Feodor Fitsner on 22 Oct, 2014 05:41 PM

    Feodor Fitsner's Avatar

    Will take a look!

  2. 2 Posted by ricardo.polo on 23 Oct, 2014 12:28 AM

    ricardo.polo's Avatar

    I Confirm it happes with every Oulook Addind Certificate like this
    https://github.com/ricardopolo/OutlookAddin

    I found that it happens because the certificate used for the ClickOne manifest of the project is not present in the AppVeyor server. Do you Know how can we include a PFX in the project?

  3. Support Staff 3 Posted by Feodor Fitsner on 23 Oct, 2014 12:49 AM

    Feodor Fitsner's Avatar

    You can put PFX certificate into repo then use PowerShell to import it: http://technet.microsoft.com/en-us/library/hh848625.aspx

  4. Support Staff 4 Posted by Feodor Fitsner on 24 Oct, 2014 05:02 AM

    Feodor Fitsner's Avatar

    Ricardo,

    I've made a simple Outlook add-in project to demonstrate how to install certificate: https://ci.appveyor.com/project/appvyr/office-addins-test

    The repository: https://github.com/FeodorFitsner/office-addins-test

    appveyor.yml: https://github.com/FeodorFitsner/office-addins-test/blob/master/app...

    Let me know if you have any questions.

  5. 5 Posted by ricardo.polo on 27 Oct, 2014 02:22 AM

    ricardo.polo's Avatar

    Thank you Feodor. I'll take a look.

    One last thing, how do you ensure that for public project not every one gets the private key of the certificate?

    In your AppVeyore.yml you are not specifying a password for the PFX. Is this a file without password or you are storing it in another place?
    I think I could store the password in the Encrypt configuration data of Appveyor, but it wont compile for the developers in their computer? Do you have any idea?

    Thanks and best regards

  6. Support Staff 6 Posted by Feodor Fitsner on 27 Oct, 2014 11:19 PM

    Feodor Fitsner's Avatar

    Right, in the example above I used default PFX without password.

    You can Encrypt environment variable on AppVeyor UI (http://www.appveyor.com/docs/build-configuration#secure-variables), put encrypted value to appveyor.yml then use this variable in cmdlet call:

    before_build:
      - ps: $psw = ConvertTo-SecureString $env:my_secure_var -AsPlainText
      - ps: Import-PfxCertificate -FilePath .\BasicOutlookAddIn\BasicOutlookAddIn_TemporaryKey.pfx -CertStoreLocation cert:\CurrentUser\My -Password $psw
    

    If you want to put this in a build script and then use the same script on both AppVeyor and developer machines you can store any sensitive data in their registries, so in your build script you have:

    $psw = (Get-ItemProperty -path HKCU:\SOFTWARE\MyCompany\MyProject).PfxPassword
    Import-PfxCertificate -FilePath .\BasicOutlookAddIn\BasicOutlookAddIn_TemporaryKey.pfx -CertStoreLocation cert:\CurrentUser\My -Password $psw
    

    where HKCU:\SOFTWARE\MyCompany\MyProject is your custom key with project build settings (keys, connection string, passwords, etc.) and PfxPassword is string value with PFX password.

    To use the same script in AV environment you should put PfxPassword before the build:

    New-ItemProperty -path HKCU:\SOFTWARE\MyCompany\MyProject -Name PfxPassword -Value $env:my_secure_var
    

    Do you get the idea?

  7. 7 Posted by ricardo.polo on 30 Oct, 2014 03:13 AM

    ricardo.polo's Avatar

    Hello. I tried my self and works as expected.
    Would be great if from the AppVeyor console you can instal digital certificates.

    Meanwhile this work:
    In AppVeyor.yaml:

    environment:
      pfx_password:
        secure: yfky3xGsKE0Kwe2xOHB2sQ==

    before_build:
      - ps: New-Item -path HKCU:\SOFTWARE\Company
      - ps: New-ItemProperty -path HKCU:\SOFTWARE\Company -Name PfxPassword -Value $env:pfx_password
      - ps: .\build.ps1

    ---

    In build.ps1
    $psw = (Get-ItemProperty -path HKCU:\SOFTWARE\Tulpep).PfxPassword
    if(!$psw)
    {
    throw "HKCU\Software\Company\PfxPassword does not exist"
    }
    $psw = ConvertTo-SecureString $psw -AsPlainText -Force
    Import-PfxCertificate -FilePath .\Certificate.pfx -CertStoreLocation cert:\CurrentUser\My -Password $psw

  8. Support Staff 8 Posted by Feodor Fitsner on 30 Oct, 2014 03:26 AM

    Feodor Fitsner's Avatar

    Cool, thanks for the update!

    Installing certificates from UI could be something we can do in the future provided there are more project types that could benefit from that.

  9. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:49 AM.

Comments are currently closed for this discussion. You can start a new one.

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

 

01 Oct, 2024 04:27 PM
26 Sep, 2024 03:49 PM
26 Sep, 2024 09:02 AM
25 Sep, 2024 07:07 PM
24 Sep, 2024 08:39 PM
24 Sep, 2024 06:47 AM