views:

50

answers:

2

Hello Experts!!!

I've been facing a deployment problem.I've built a WPF application with visual studio 2008 and created an installer(msi) which works fine.But then it's pain to add automatic update to it. i've seen this article at windowsclient.net but it seems to be pretty old but could have been the perfect thing for me.Then i looked at the .Net Application updater block v2.0 which uses enterprise library june 2005 and for some reason it's not installing on my machine.

I thought i will need to use a more recent Enterprise library so i installed and compiled Enterprise 4.1(october 2008) but nothing better happened.To i decided to give a try to CLickonce deployment.After struggling with it, it was almost perfect.I realized that when i was testing the updates provided by the clickonce on my machine which is XP i didn't notice the need of having sqlite dll in the GAC. surely it was already there.I noticed it when i moved to vista that there is a problem.After checking the net i know it's impossible to add a dll to the Global Assembly Cache.
Now i'm stuck, i think i've hit a wall.Can any one share some of his experience? I'm willing to try the updater block if i can get help.

Thanks for reading this!!

A: 

First, you can't use that updater block. It was for .NET 1.1. It was marked obsolete when ClickOnce deployment was added in .NET 2.0.

You probably don't need to install that dll in the GAC. In many cases, you can just include it in the deployment, and it will find the local reference and use it. It just depends on the dll. So here's what I recommend you try:

Add the dll to your project. Set the 'build action' to 'none'. Set 'copy to local directory' as 'do not copy'.

Delete the reference in your project to that dll, and re-add it. But instead of picking it from the GAC, browse to the one you just added to your project and select it. On the reference properties, set 'copy local' to 'true'.

Now when you run it, it will access the local copy instead of looking for one in the GAC.

Like I said, this works great in some cases. It works for SQLCE and DirectX, but not for something like Infragistics. Some assemblies really do have to be installed in the GAC. The only way you will know is if you try it.

If you DO end up having to put it in the GAC, you can create an MSI to do that and deploy it as a prerequisite to the ClickOnce application. So you can still use ClickOnce for your main app.

RobinDotNet
i've found a way to solve this.I 've tried the ssce and set the database its "Build action" to content and it's copy to output Directory to copy always and everything works fine in the deployed pc.I Still want to use and updater.Can you point me to a direction? thanks for the reply though
black sensei
+1  A: 

(Won't fit in a comment)

Here's something helpful -- you can deploy the SQLCE dll's locally, instead of installing as a prerequisite, which makes it easier to deploy. Check out this article.

This is another useful article: how to keep your data safe from ClickOnce updates.

This will make more sense if you check out this thread. I have a post in this thread that has two links in it. One points to the ClickOnce way of handling database deployment, the other to a thread that is essentially the same as the blog article above.

RobinDotNet
thanks robin this gave me enough info to get going.I'have try your methods yet but i think it'll be alright.I have 2 other concerns though. from this link :http://social.msdn.microsoft.com/forums/en-US/winformssetup/thread/fc92694c-fd68-4ce6-b1c5-617359f08883/ 1:where does that code goes in a wpf projet?i guess it will be in program.cs in a winform project. 2:does LocalApplicationData resolve to a well know folder on different platforms as xp,vista,windows7.i'm on xp and users might use windows 7 or vista.should i worry for that?thanks for the effort and replies.
black sensei
never mind for question 1. i found that one can use main method. as in this thread http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e5757d5c-28f3-4233-8a5f-00116587d5c7 thanks.By the way in one of your blogs you are suggesting to set a connectionstring a runtime.that means the connectionstring should be in settings.properties with the scope set to user since technically app.config is a read-only file.correct me if i'im wrong.if i use a separate xml file to store my connectionstring, will it be overridden by the clickonce update?thanks for this useful conversation
black sensei
LocalApplicationData is a .NET Environment variable; it resolve to C:\users\username\AppData\Local on Vista and 7. On XP, It's something like c:\documents and settings\username\applicationdata\localsettings\appdata. If you can't find it, post back and I'll look it up. Also, yes, it would go in program.cs. I haven't done WPF in over a year -- does it not have a program.cs for starting up the app? You just need to put the move-the-db code somewhere before it opens it.
RobinDotNet
Yes, app.config is pretty much read-only. With clickonce, the user settings are carried forward when an update is installed. If you try this out, I think they end up under the apps\2.0\data folder, they aren't in the same folder as the application itself.
RobinDotNet