仅在线的 ClickOnce 应用程序未通过网络更新 link

Online-only ClickOnce app not updating through web link

我正在开发一个设置为仅在线的 ClickOnce 应用程序。我将其发布到内部 IIS 服务器,在包含此 link:

的同一目录中有一个 HTML 页面
<a href="MyAppName.application"></a>

部署看起来像这样,除了 HTML 页面之外的所有文件都是由我项目的 publish 目标生成的:

MyAppName
 -> Application Files
     -> MyAppName_2213_20_0_65
         -> <The published files>
 -> default.html
 -> MyAppName.application

当我点击 link 时,应用程序 运行 立即出现,没有任何确认提示,我从关于框中看到它是旧版本。当我浏览到文件共享并通过在资源管理器中双击它来启动 MyAppName.application 时,我收到提示询问我是否想要 运行 它,然后它下载并得到一个错误:

Unable to install this application because an application with the same identity is already installed. To install this application, either modify the manifest version for this application or uninstall the preexisting application.

作为构建过程的一部分,我将项目的 InstallUrl 属性 设置为 http://ourserver/MyAppName/MyAppName.application。那是错的吗?它应该是包含 link 的 HTML 页面吗?它如何确定产生冲突的 "identity"?

由于该应用仅供在线使用,因此未安装且未显示在“程序和功能”控制面板中(因此错误消息的那部分内容不适用)。

我是 ClickOnce 的新手,所以如果我遗漏了一些有用的信息,请告诉我。

更新

如果我从 Visual Studio 命令提示符 运行 mage -cc 启动,将启动新版本而不是旧版本。

更新 2

当我四处寻找时,我看到了一些看起来不对劲的东西,这可能就是问题所在。我在 MyAppName.application 文件(部署清单)中看到以下两行:

...
  <assemblyIdentity name="MyAppName" version="1.0.0.0" ...
...
  <dependency>
    <dependentAssembly dependencyType="install" codebase="Application Files\MyAppName_2213_20_0_65\MyAppName.exe.manifest" size="82044">
      <assemblyIdentity name="MyAppName.exe" version="1.0.0.0" ...
...

你可以看到上面的不匹配。它正在部署到 MyAppName_2213_20_0_65,但它认为 exe 的版本号是 1.0.0.0。我不确定为什么会这样想。我的项目包含一个文件,该文件作为构建的一部分使用以下行生成:

[assembly: AssemblyVersion("2213.20.0.65")]

然后,要设置发布的版本号,我的 csproj 文件中有这个:

<Target Name="BeforePublish">
  <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
    <Output TaskParameter="Assemblies" ItemName="MyAppAssemblyInfo" />
  </GetAssemblyIdentity>
  <PropertyGroup>
    <ApplicationVersion>%(MyAppAssemblyInfo.Version)</ApplicationVersion>
    <InstallUrl>$(INSTALL_URL)</InstallUrl>
  </PropertyGroup>
</Target>

为我的可执行文件列出的程序集版本重要吗?如果是,为什么卡在 1.0.0.0 上,这是否会影响更新版本的下载?

我的第二次更新让我走上了正确的轨道。问题确实是 assemblyIdentity 属性的版本号不正确。为了修复它,我不再使用 BeforePublish 目标。相反,我在调用 MSBuild:

时传入了 ApplicationVersion
"%msbuild_path%" MyAppName.csproj /target:Publish /p:ApplicationVersion=%VERSION%