Publishing from Visual Studio 2015 - allow untrusted certificates

For dot net core 1.0 you have to add the tag

 <AllowUntrustedCertificate>True</AllowUntrustedCertificate>

to publishprofiles in your .pubxml file


The option to allow untrusted certificates is not yet supported in the current tooling. Hopefully, this gets updated very soon. You can, however, set it manually.

  1. Open the publish profile file (.pubxml) inside /Properties/PublishProfiles in a text editor
  2. Inside the <PropertyGroup> element, set AllowUntrustedCertificate to True (<AllowUntrustedCertificate>True</AllowUntrustedCertificate>) or add it if it doesn't exist
  3. Set UsePowerShell to False (<UsePowerShell>False</UsePowerShell>).

At this time of writing, the generated powershell script disregards the AllowUntrustedCertificate property which is probably a bug, hence, the need to set it to False.

You can get powershell to work if you update the module version in the .ps1 file.

As a side note, you can also get around this problem by "trusting" the server's certificate locally.


I had <UsePowerShell>True</UsePowerShell> but it was still failing with the cert error.

  • I re-entered my password in the settings dialog and it still failed
  • Once I clicked on Validate Connection it started working.

Publish Settings Dialog

Note

  • VS 2017 (15.2)
  • My password recently changed
  • As a test, entered the wrong password and I got the cert error so the cert error is not just about an untrusted cert apparently