MSBuild ClickOnce error: “Deployment and application do not have matching security zones”

丶灬走出姿态 提交于 2019-12-22 02:33:22

问题


We're trying to publish a ClickOnce application through MSBuild. We've got it working fine for an installed version of the Windows application.

However, when we set install to false, so that it just runs the application from the web, we get the following error when we try to run the application from the URL: "Deployment and application do not have matching security zones" This works fine in Internet Explorer. We only get the error message in Chrome and FireFox.

Here is a sample of the project file settings.

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <SrcTreeRoot>$(MSBuildProjectDirectory)\..\..\..</SrcTreeRoot>
    <!--ClickOnceDeployFolder>$(WebOutputDir)\AnalyzerPC</ClickOnceDeployFolder-->
    <ProjectGuid>{8205E593-F400-41AE-8D6F-DEA290B2DCF9}</ProjectGuid>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ApplicationIcon>Graphics\EDA Icon.ico</ApplicationIcon>
    <AssemblyName>DASHQueryBuilder</AssemblyName>
    <OutputType>WinExe</OutputType>
    <RootNamespace>TetraData.Analyzer</RootNamespace>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <OldToolsVersion>2.0</OldToolsVersion>
    <IsWebBootstrapper>false</IsWebBootstrapper>
    <ManifestCertificateThumbprint>...</ManifestCertificateThumbprint>
    <GenerateManifests>true</GenerateManifests>
    <SignManifests>true</SignManifests>
    <SignAssembly>true</SignAssembly>
    <ManifestKeyFile>$(BuildDir)\Certificates\TetraDataCode.pfx</ManifestKeyFile>
    <ProductVersion>9.0.21022</ProductVersion>
    <PublishUrl>http://localhost/DASHQueryBuilder/</PublishUrl>
    <Install>false</Install>
    <!--InstallFrom>Web</InstallFrom-->
    <UpdateEnabled>false</UpdateEnabled>
    <MapFileExtensions>true</MapFileExtensions>
    <PublisherName>Follett Software Company</PublisherName>
    <TrustUrlParameters>true</TrustUrlParameters>
    <ApplicationRevision>0</ApplicationRevision>
    <UseApplicationTrust>false</UseApplicationTrust>
    <PublishWizardCompleted>true</PublishWizardCompleted>
    <BootstrapperEnabled>false</BootstrapperEnabled>
  </PropertyGroup>
  <Import Project="$(SrcTreeRoot)\Build\TaskInit.Tasks" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(SrcTreeRoot)\Build\TaskOverrides.Tasks" />
  <Import Project="$(MSBuildProjectDirectory)\Analyzer.csproj" />
  <PropertyGroup>
    <PublishDir>$(WebOutputDir)\DASH Query Builder\</PublishDir>
    <ApplicationVersion>$(MajorMinorVersion).0.0</ApplicationVersion>
  </PropertyGroup>
  <Target Name="BeforeResolveReferences">
    <Copy SourceFiles="$(MSBuildProjectDirectory)\DASHQueryBuilder.config" DestinationFiles="$(MSBuildProjectDirectory)\app.config" />
  </Target>
</Project>

回答1:


Below is Microsoft's answer to the thread I posted on their forum. Basically they did support chrome back then, but now there is a plugin for Chrome here that works great.

Hi fbanderson,

I found an article talking about ClickOnce in Firefox.

http://windowsclient.net/wpf/wpf35/wpf-deploying-clickonce-ie-firefox.aspx

.NET Framework 3.5 SP1 offers a component called .NET Framework Assistant 1.0 which handles ClickOnce .applications. If you have installed that component, the dialog appear to you in FireFox should contain a “Run ClickOnce application” button. Do you see that button when you trying to launch the app?

For Google Chrome, we don’t have experience for it. It is a new browser and we lack test on it.

Sincerely,

Kira Qian

MSDN Subscriber Support in Forum

If you have any feedback on our support, please contact msdnmg@microsoft.com Please remember to mark the replies as answers if they help and unmark them if they provide no help. Welcome to the




回答2:


I found a solution that I'll be glad to share with you. You can do it with MageUI or with Visual Studio. I am really delighted to use ClickOnce as my deployment now works both with Internet Explorer, Chrome, and Firefox.

MageUI

If you use MageUI, you have to check Include the provider URL in the Manifest and type the associated URL of the web server.

Visual Studio

If you use Microsoft Visual Studio, then on the Publish tab of the project properties, click on the Updates... button, then in the update location, type the URL of the publishing Web Server.




回答3:


Chrome and other browsers may try to install clickonce apps from a downloaded version of myapp.application (without the rest of the payload). This causes havoc (with strange error messages) if you want the install to happen from a website. To ensure this works as intended you can do what is mentioned in this answer or, if using scripting with Mage, some variant of this command - dim deploymentCmd : deploymentCmd = chr(34) & mageExePath & chr(34) & " -New Deployment -Name " & chr(34) & "My Application" & chr(34) : deploymentCmd = deploymentCmd & " -ProviderURL [full url]myapp.application -IncludeProviderURL true"...



来源:https://stackoverflow.com/questions/2806313/msbuild-clickonce-error-deployment-and-application-do-not-have-matching-securi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!