.Net Windows Services and InstallState file - is it really needed?

雨燕双飞 提交于 2019-12-03 16:52:17

问题


I've got a number of managed code Windows Services for which we use the Frameworks InstallUtil tool to install into the service control manager. This tool creates a new file at install time with an extension of .InstallState. I have experimented with deleting this file and an uninstall still works fine afterwards.

So my questions is, what is this file for and is there any reason I shouldn't delete it?

Edit 5/3/10: Really? Nobody has any clue what the value of this file is?


回答1:


In VS.NET you can define a custom dialog for your msi project, I am using such a dialog to ask for the SQL Server address and credentials, the msi stores all the info from the textboxes into InstallState file. When the service is uninstalled it will read the values from InstallState file and will drop the database created in the install phase. In my case InstallState file is a must because the uninstall will fail if the file was deleted after install.




回答2:


The InstallState file is used by InstallUtil.exe for uninstalling the service/assembly. The data contained within it is uninstall data only. If you haven't read the short obscure reference on MSDN, you can read it here.

Maybe a setup package uninstalls everything for you correctly but I'm not sure if a service would uninstall properly if you were calling InstallUtil by hand/script yourself.

That's the supposed value of a .InstallState file.




回答3:


The file should be deleted by the uninstall process. If you are using a custom install action you should add it the uninstall process as well. A missing .installstate file will not prevent the service from being uninstalled.

http://adamhouldsworth.blogspot.com/2009/11/c-setup-installstate.html

http://support.microsoft.com/kb/934388



来源:https://stackoverflow.com/questions/2624848/net-windows-services-and-installstate-file-is-it-really-needed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!