I've got a small WPF application 开发者_JAVA技巧which is being deployed to a client soon. One of the prerequisites is Sql Express 2008, and the clickonce installer handles that part nicely. My issue is that, after installation, I need to be able to unzip a backed up SQL DB, restore it, and set some user privileges. I have the SQL and the code needed to do this, but I can't seem to figure out how to inject it into the clickonce install process, or how to force it to run some kind of "update" right after installation, before loading up the application. Is there any way to do this?
Consider checking IsFirstRun in your application and performing additional setup at that time. Using this method you can do just about anything you want. Here's a snippet from a webpage with more details:
Use IsFirstRun to determine whether you need to perform any one-time initialization operations the first time your application runs.
Did you have a look at this? You could create a custom action.
I am not sure whether or not you will have/need elevated permissions but it might be worth a try,
精彩评论