C# Applications Dependencies Check - c#

I have an application that i wrote in C# and it does databases. So to run this app on any machine i need .NET 3.5 and SQL Server 2005 installed. Is there a way that when the application starts. It first checks whether SQL Server 2005 and .Net 3.5 exist on the machine or not. If not then it may exit and if they do they may continue.

Checking for prerequisites is usually the job of an installer.

SQL Server 2005 can be verified, as installed SQL Server instances can be found in Services panel (which is also accessible via .NET).
It is not possible for a .NET 3.5 C# program to check whether .NET Framework is installed.
You'd better write native applications (in VC or else) to check for prerequisites.

Related

How to run desktop application with database locally without installing any database Server?

I wanted to create a desktop application with database, am using Visual Studio 2013 and C# , Can anybody suggest me what server I used to create my database, in order to run my application in my client's system locally with out installing any database server in client's system [ie, with out installing MsSql server or MySql server or Acess], I want my app works properly when installing my own application's exe file ?
And Now am using MSSQL server with my application , Is there any way run this application in client's system locally with out installing MSSQL Server? [my application front end works when I install .Net FrameWork 4.5 , I need something like this for my .mdf databse in Sql Server]
somebody says about SQL Server Compact ,but i don't know how to use it
You can use SQL Server Compact, which can either be installed separately or deployed as part of your application.
See here: How to deploy SQL Server Compact Edition 4.0?
And here: https://msdn.microsoft.com/en-gb/library/aa983326(v=vs.110).aspx
Your DB code in your app - apart from your connection string - should not need to change as you're already using some version of SQL Server.
There is also SQLite, which is as far as I know is well regarded, but I know very little about it. http://www.sqlite.org/
Hope that helps!
It is not unusual for an application to require an existing functional database server. Of course this is appropriate only if your target audience is technical enough to install the prerequisite on their own, or if the target environment is guaranteed to already meet your prerequisite.
If not, you need to fall back to an embedded database.

How to deploy the .Net Compact Framework and SQL Server Compact Edition with the Application

I have a windows mobile 6 application.For Application installation,Device require sql server ce and .net framework to run Application on the device...If a device has these Prerequisited Softwares already...the application will work.
If a device has no these Prerequisited Softwares [Sql server ce or dotnet framework to run the App] it wont work. So i need to install this also at the time of Application installation along with the cab.
How to Pack these Preqrequist Softwares with the cab file????
Or Any Other Solution to this...please help me on this...
I have added an image as i have in my application as of now....
The best way to try to include SqlServer CE and your .NET Framework files in your project is to mark your Application Project so that it includes all dependencies and include those files in your Setup Project.
That said, sometimes the installs work and sometimes they require a lot of debugging to make them work.

Redistributing the .NET framework and SQL Server Express

I have an app written in C#. It's a commercial app, written using nothing but free software (Visual C# express and SQL express). So, so far it's all clean.
For the app to work, both the .NET framework and SQL Server Express need to be installed on the clients computer. I already know some of the clients don't have internet connection (for security reasons), so I need to make an installer that would locally (off line) install all the dependencies (.NET framework and SQL Server Express).
So, can I (legally) burn both the .NET framework and SQL Server Express installers on the instalation CD so that the client can just click install and not have to worry about anyting?
I tried contacting Microsoft directly to ask them, but I had no luck.
Well, this Microsoft page will tell you what you needd to redistribute SQL Server Express. And here's a link about redistributing the .NET framework.
Basically, you don't really have any major restrictions when it comes to redistributing either of them. Just dig around the Microsoft website and you'll find everything you'd ever need.

how to set launch condition order in visual studio 2008?

I have an WPF and SQL-Server Express based app which I want to deploy using VS-2008 setup and deployment project template. I have added Launch condition for Windows Installer 3.1, Sql Express 2005 and .Net FrameWork 3.5 with SP1 but they are not running in order. I mean:
Windows Installer checking
.Net Framework 3.5 sp1 checking
SQL-Server Express 2005 checking
When i built my project and ran on test machine (with Fresh XP installation only) it tried to install SQL-Server Express 2005 first and then failed for windows installer 3.1.
One more thing i want to know how i can run my DB script after installation of SQL-Server Express 2005.
How I can solve these 2 issues.
I don't think your question actually deals with LaunchConditions as the purpose of LaunchConditions is to prevent the installation of a Windows Installer package if certain conditions aren't met. What you are describing sounds morel ike prereq chaining although I'm not certain what tool you are using to author your install and thus which setup.exe to do the chaining.
I'd also look at putting MSI 4.5 in your chainer, MSI 3.1 is very old in the tooth and only applies to Windows XP these days as all newer OS's come with atleast 4.0.

Microsoft.ExceptionMessageBox not being "found"

I have a winform solution that I deploy through clickOnce. There is the Main Project and then a Project called psWinForms. That project has a Reference to Microsoft.ExceptionMessageBox that I use in my custom error reporting.
I have psWinForms as a reference in my Main Project with Copy Local = True.
I have Microsoft.ExceptionMessageBox as a reference in psWinForms with Copy Local = False & Specific Version = False
In Application Files I have Publish Status =Prerequisite(Auto)
I have tried various combinations to no avail.
I looked here on the Test System on the DLL is there.
C:\Program Files\Microsoft SQL Server\90\SDK\Assemblies
I am using the ExceptionMessageBox from SQL version 9.0.242.0 if that makes a difference and the users only have SQL 2005 Express(9.0.1399.0) installed.
So I am very confused as to why my app hangs when I try to throw an error using this....
You can't copy and deploy the assembly yourself, it has to be installed as part of the SQL client components. There are different client components for SQL 2008 and SQL 2005, your application has to reference the proper one. So you'll have to ship two different applications, one compiled for SQL 2005 and one for SQL 2008 and your users will have to install the proper one. From Deploying an Exception Message Box Application:
The exception message box is installed
by Microsoft SQL Server and is
supported for use in your custom
Windows applications to improve
exception handling. Because the
exception message box is installed by
all editions of SQL Server except SQL
Server Compact 3.5 SP1, you can use it
with no additional configuration on
any computer on which SQL Server
client components, including the SDK,
have been installed.
While technically is probably possible to deploy the assembly and add it to the GAC yourself is a bad practice as your dll will not be part of the normal chain of service packs and cummulative upgrade patches.
Also you better clear up with an MS representative whether deploying this dll standalone is OK with the SQL client usage license or not. Every component that can be redistributed under the license has an install msi available for developers to distribute. If this dll does not is a strong indicator that is not allowed to be redistributed by 3rd parties (you).
Update
There is actually a distributable msi (SQLServer2005_EMB.msi, SQLServer2005_EMB_x64.msi) for the ExceptionMessageBox component:
In SQL Server 2005 SP1 and later
releases, the exception message box is
also provided as a redistributable
installation program that you can
distribute and deploy with your
application... The redistributable
installation program for exception
message box is available online as
part of the Feature Pack for SQL
Server 2005 SP1.
do you have the assembly referenced in your MAIN application? I didn't see that scenario listed...I have found that for copy local to work, you need to have all sub-projects references in the main application reference list otherwise you get unpredictable results.
Also if you need your specific file to be used, make sure use specific version is true.
the same goes for App.config sections...if you have project level appconfigs you have to merge that with the application level app.config.

Categories