This is a on-prem TFS question. Yesterday I put a certificate in place to handle signing ClickOnce deployments. However, it fails to apply the certificate. They guy who wrote these release scripts before me, the former TFS administrator, was a PowerShell guru. I am not a PowerShell guru. However, I can muddle my way into trying to figure out what is going on, up to a point. The errors occur in the Release, not in the build. The first error that appears is, “You cannot call a method on a null-valued expression”. I believe I’ve found the line where that error occurs, from the PowerShell++ script he uses. It is here:
> $cert = ls cert:\ -Recurse -CodeSigningCert | ? {$_.Verify()} | Select -First 1
I’ve broken this line down into its parts. Ignoring the assignment to the variable $cert, this part of the PowerShell script works: $cert = ls cert:\ -Recurse -CodeSigningCert
. However, the rest of the line, ? {$_.Verify()} | Select -First 1
results in assigning a null to $cert. This same script has worked fine, for two years, with no problems. Why has importing a new certificate into the TFS build server made this assignment fail?