一键发布绕过证书验证

One Click Publish Bypass Certificate Validation

我正在使用 VS2015 Update 1 尝试一键发布 aspnet 5 vNext MVC 站点。我要发布到的服务器没有真正的证书,因此出现错误:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : Error Code: ERROR_CERTIFICATE_VALIDATION_FAILED

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : More Information: Connected to the remote computer ("REDACTED") using the specified process ("Web Management Service"), but could not verify the server's certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : Error: The remote certificate is invalid according to the validation procedure.

根据(相当旧的)link,我发现我可以通过手动 运行 msbuild 命令并传递 -allowUntrusted 开关轻松地使其工作。但是,我找不到 UI 对话框设置,*.pubxml 中的 XML 标记,也找不到 *publish.ps1 文件中使此行为在 [=20= 中起作用的好地方].

如何让一键发布忽略我服务器的无效证书?

*One Click pub.xml 文件

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    ...
    <AllowUntrustedCertificate>True</AllowUntrustedCertificate>
    ...