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!

)
Jhon DalchemskiPosted Nov 9, 2010, 12:30 PM
Thanks Jean Paul for your answer
Dear Jean, now, our facing problem is how to do above mentioned enforcements. Of course, after seeing an explanation of Mr Dave Kreskowiak and also depend on my former background, I found this enforcements rather illogical in absence of some required conditions such as being aware of Sql Epress directory[ to avoid others' data deletion ]. In fact, all my problems spawned from trying to resolve another original problem: how to avoid the exception by a message like "the program couldn't create an instance of sql server "[ is a result of placing 'User Instance = true' in our connection string to attach a db file]. the solution that I found in the most of web pages was to delete Sql Express directory and then restarting the system. This works but as is mentioned in above link is unsafe and also because of raising above problems ( see my first post ), impractical. Thus your answers, if any, to the above original problems or its descendent problems is greatly appreciated. In addition I must thank you for your information that some of, was new to me.
Jean PaulPosted Nov 9, 2010, 7:26 AM
If it exists you can skip the installation. (you can create post commit actions in the setup project)
I believe try connecting to the master table can reveal whether instance is installed or not. (else use registry)