I am trying to automatic clickonce application deployment throught TFS continuous integration, my build definition has the following steps (It is simplified, for demostring reasons)
Get sources: from TFS server
Nuget restore : Restore nuget packages
PowerShell script: Used to add certificate to main project of the solution as below:
$password = 'password'
Add-Type -AssemblyName System.Security
$cert = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2
$cert.Import("$(CertPath)", $password, [System.Security.Cryptography.X509Certificates.X509KeyStorageFlags]"PersistKeySet")
$store = new-object system.security.cryptography.X509Certificates.X509Store -argumentlist "MY", CurrentUser
$store.Open([System.Security.Cryptography.X509Certificates.OpenFlags]"ReadWrite")
$store.Add($cert)
$store.Close()
MSBuild: Build the solution file
All runs correctly, but when i trying to open the exe File on the agent Bin/release path, i am having this exception:
Please help me.
I deleted the agent and made a new compilation and everything worked. Thanks