Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
462 views
in Technique[技术] by (71.8m points)

crystal reports - .NET ClickOnce not installing prerequisite files?

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...

"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."

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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.

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.

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...