In my application I have one windows form application and two windows services. Currently I am using .net setup project to install application and windows services. I have added custom action which opens windows form and accepts SQL server detail to creates SQL database for the application.
I am raising InstallException if user closes or clicks Cancel button on the form to cancel setup wizard.
The problem I am facing is after cancelling setup wizard using InstallException, it gives error “Error 1001. Could not find file ‘C:\Program Files (x86)\MyApp\MyService1.InstallState’.” for both of my windows service one by one.
For temporary solution I kept both InstallState file and added manually in my setup project which adds both InstallState file to installation directory.
It worked for few months. But after some change in application it started giving me some other error “Error 1001. Object type not found for element ArrayOfKeyValueOfanyTypeanyType System.Collections.Hashtable”
I found that it need to add again new InstallState file for the changes.
I think this is not the proper way to adding InstallState file manually.
Has anybody other idea to implement in my setup project to overcome this problem?
I need to rollback SQL database changes(creating database) if user cancels installation wizard at the time of installation and if user cancels un-install wizard it should not delete database.
Thanks in advance.
I solved the problem my self. The custom action sequence was
1)Custom action dll
2)Windows Service 1
3)Windows Service 2
I changed sequence to
1)Windows Service 1
2)Windows Service 2
3)Custom action dll
I think it was trying to rollback windows service state and windows service was not installed in 1st case