Click here to Skip to main content
15,905,419 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
We have implemented a C#.NET app. That we are forced to distribute it to our customers with a little computing and IT knowledge via a CD. We are forced also to accumulate prerequisites such as .NET Framework 3.5 and Sql Express 2005 with our app. On the CD because of low speed internet in our country and also our custormers low comutational knowledge as mentioned above. To gain this goal we selected VS 2008 setup and deployment projects project type. After overcoming a lot of problems, now we are faced by another problem that after spending a lot hours searching different web pages we did 'nt gain a suitable solution to it. The problem is when the Sql Epress 2005, already is installed on the machine which we want to install our app on it; our app. throws an exception by message like "sql server could 'nt create a user instance…". Of course we know to resolve this problem manually we should delete folder "C:\Doument and Settings\UserName\Local Settings\Application\Sql Server\Sql Express"( Sql Express Directory ) and then restart the system but problem is our low computation knowledge customers; what if they want to reinstalling the app?!. Thus we must automate the above solution ( deletion the directory of Sql Express 2005 ). In search for solution, I decided to write a batch file which delete the Sql Express directory while uninstalling the program and then reboot the system. Of course my solution failed because of problems such as not having sufficient privileges to run commands such as 'Shut down -r' in the batch file and also some times when trying to delete the Sql Express directory We faced by an error message such as 'some of containment files are being used by other application …' and so on. Know we are concerned with occurrence of this problems on our low knowledge customers ' systems which are hundreds kilometers distant from us and our sole media to guide them to get the system working are phone lines.

Can you tell us please if there is a better way to overcome our problems? Or are the any good solutions which resolve my solution problems so that our low computational customer could experience a comfort and silent installation a way from technical problems according to our used technologies?

In advance, thanks a lot for your short and useful solutions ( against my question!:) )
Posted
Comments
aidin Tajadod 7-Nov-10 1:58am    
Why don't you expand your idea about batch files and write another App to do it for you.
You have to noticed that you can not write it with .net. you need to write a small App in c++ to check the conditions and then call the setup.
ssh89 7-Nov-10 14:14pm    
thanks aidin
we can check conditions sanctification even by our batch file but we can't force the system to go to our desired conditions while necessity. for example if we uninstall our App. and then , without restarting the system , try to delete Sql Express directory "C:\Doument and Settings\UserName\Local Settings\Application\Sql Server\Sql Express" [ becase is needed for our App. to work properly ], the operation fails by a message such as 'windows couldn't delete the folder because one of its files is being used by other program'. also we could'nt execute command 'shutdown -r' from our batch file because we have not sufficient permissions to do that as our XP OS says. maybe finally we learn how to grant this permission on Our OS but what about our low knowledge customers which expect all this tasks to be done automatically? we must add that while installing the program we can do any silent operation with our customers' systems, of course by our own responsibility.

You can't get more permissions that the user already has. You have to tell the user thaat they have to restart the machine.

As for SQL Express, deleting the users installation is a horrible move as you have no idea if your app installed it or some other app.

In removing that directory, what you forget to check is if SQL is still running! If it's running, you cannot delete its folder and the contents of it. You have to shutdown the SQL Server (IF the user has the permissions to do so), then UNINSTALL IT, not just kill its folder.

You've got a lot of work to do to get this to work and you're not going to do it in a batch file. You have to write your own installer to figure all of these details out. Oh! And most of what you want to do can only be done under an admin level account!
 
Share this answer
 
Comments
jjjjj.3.34767j 9-Nov-10 12:17pm    
Thanks Mr X
I must confess, this is not logical to delete Sql Express directory when we haven't created it [ so we aren't aware of its content ]; But this was the best solution I found in search for the solution of a problem in a lot of web pages. The problem is that some times that we install our app in a system ,with sql express installed, its execution is broke down by an exception that is message is like "the program couldn't create an instance of sql server". I must add our app. Installs Sql Express by its default instance( SQLEXPRESS ) in lack of Sql Express in client system. The best solution for mentioned problem, I found in Internet was delete Sql Express directory and then restarting the system. Can anyone please, show me a better way to overcome this problem?!. Also according to app. Usage of an accompanying for data storage, does I 'm going to being struck by any danger when I follow above solution ( deleting Sql Express directory ); if I 'm, please aware me of this danger(s). But about using another solution than a batch file; I think every other programming language need to communicate OS to change its file system, Just what also a batch file can do. But also about learning InstallSheild Express; does it let me to distribute .NET Framework 3.5, Sql Express 2005 and Crystal Reports 2008 5 to my clients' OS? If it does, please say me which version?
I must add that our reason for selecting VS 2008 setup and deployment projects type was time shortage for learning other maybe better technologies.

Thanks again, excuse my verbose post
ssh89 9-Nov-10 12:34pm    
Thanks Mr Dave Kreskowiak
I must confess, this is not logical to delete Sql Express directory when we haven't created it [ so we aren't aware of its content ]; But this was the best solution I found in search for the solution of a problem in a lot of web pages. The problem is that some times that we install our app in a system ,with sql express installed, its execution is broke down by an exception that is message is like "the program couldn't create an instance of sql server". I must add our app. Installs Sql Express by its default instance( SQLEXPRESS ) in lack of Sql Express in client system. The best solution for mentioned problem, I found in Internet was delete Sql Express directory and then restarting the system. Can anyone please, show me a better way to overcome this problem?!. Also according to app. Usage of an accompanying for data storage, does I 'm going to being struck by any danger when I follow above solution ( deleting Sql Express directory ); if I 'm, please aware me of this danger(s). But about using another solution than a batch file; I think every other programming language need to communicate OS to change its file system, Just what also a batch file can do. But also about learning InstallSheild Express; does it let me to distribute .NET Framework 3.5, Sql Express 2005 and Crystal Reports 2008 5 to my clients' OS? If it does, please say me which version?
I must add that our reason for selecting VS 2008 setup and deployment projects type was time shortage for learning other maybe better technologies.

Thanks again, excuse my verbose post
Oh! And I almost forgot. The Setup and Deployment project is officially a dead technology. I highly suggest you start learning InstallShield Express.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900