.NET ClickOnce 没有安装必备文件? [英] .NET ClickOnce not installing prerequisite files?

查看:29
本文介绍了.NET ClickOnce 没有安装必备文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Crystal Reports 的 .NET 项目.该应用程序使用 ClickOnce 分发.如果用户在他们的计算机上安装了 Crystal,那么一切都会很好.但是,并非所有最终用户的计算机上都安装了 Crystal Reports.这些用户收到以下错误...

I have a .NET project that uses Crystal Reports. The application is distributed using ClickOnce. Things work great if the user has Crystal installed on their computer. However, not all of the end users have Crystal Reports installed on their computers. These users are receiving the following error...

无法安装或运行该应用程序.该应用程序要求首先在全局程序集缓存 (GAC) 中安装程序集 CrystalDecisions.ReportAppServer.XmlSerialize 版本 10.5.3700.0."

"Unable to install or run the application. The application requires that assembly CrystalDecisions.ReportAppServer.XmlSerialize Version 10.5.3700.0 be installed in the Global Assembly Cache (GAC) first."

有没有办法强制安装 ClickOnce 以确保安装了先决条件?

Is there a way to force ClickOnce installs to ensure that a prerequisite is installed?

推荐答案

没有.ClickOnce 和先决条件存在很多混淆.

No. There is a lot of confusion over ClickOnce and prerequisites.

ClickOnce 对先决条件什么都不做.没有什么.ClickOnce 将文件从服务器复制到客户端计算机,并在服务器文件更新时使这些文件保持同步 - 就是这样.不能在GAC里面放东西,不能注册dll,不能安装msi文件等等.

ClickOnce does nothing with prereqs. Nothing. ClickOnce copies files from a server to a client's machine and keeps those files in sync when the server files are updated - that's it. It can't put things in the GAC, register dlls, install msi files, etc.

当您使用 Visual Studio 进行部署时,就会出现混淆.当您发布与 ClickOnce 无关的内容时,VS 会为您做几件事.一方面,它为您创建了一个漂亮的 html 页面,其中包含一些指向您的部署的链接.此外,它还允许您从几个先决条件中进行选择,并为您创建一个引导程序 exe.我假设您是为 Crystal Reports 安装执行此操作的.引导程序只是管理多个先决条件的一种简单方法.在安装您的应用程序之前,引导程序不会告诉您的用户安装 X,然后是 Y,然后是 Z,而是让这三个安装无缝",因此它们看起来好像是一个大安装.如果用户已经拥有它,它也可以跳过 prereq 安装.

Where the confusion comes in is when you deploy with Visual Studio. VS does several things for you when you publish that really have nothing to do with ClickOnce. For one, it creates a nice html page for you with some links to your deployment. Also, it lets you pick from several prereqs and will create a bootstrapper exe for you. I'm assuming you did this for the Crystal Reports install. The bootstrapper is just a simple way to manage multiple prereqs. Rather than telling your user to install X, then Y, then Z before installing your app, the bootstrapper makes those three installs "seamless" so they appear as if they are one big install. It can also skip prereq installs if the user already has it.

如果你注意你VS生成的html页面,你可以看到两个链接.一个到您的 .application 文件(ClickOnce 部署),一个到引导程序 exe.您几乎受制于用户,并且必须依靠他们来阅读页面并在需要时运行引导程序..Net Framework 是一个例外,因为 html 页面可以通过 UserAgent 字符串检查.

If you pay attention on your html page that VS generates, you can see two links. One to your .application file (the ClickOnce deployment) and one to the bootstrapper exe. You are pretty much at the mercy of the user and must rely on them to read the page and run the bootstrapper if they need to. The one exception to that is the .Net Framework since the html page can check for that through the UserAgent string.

如果他们运行引导程序,他们会得到与您所询问的错误非常相似的错误.

If they don't run the bootstrapper they'll get errors much like the one you're asking about.

一种可能的解决方案是编写代码来检查它是否已安装.它可以检查注册表或程序文件"文件夹;无论您需要做什么来确保它已安装.然后优雅地退出并通知用户如果他们没有它.只要您在尝试加载和使用 Crystal 程序集之前进行检查,这将起作用.

One possible solution is to write code to check if it's installed. It could check the registry or the "Program Files" folder; whatever you need to do to make sure it's installed. Then exit gracefully and inform the user if they don't have it. That will work as long as you do the check before you try to load and use the Crystal assemblies.

祝你好运!如果您提出更好的解决方案,请回复.

Good luck! Please respond if you come up with a better solution.

这篇关于.NET ClickOnce 没有安装必备文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆