VS Creating Installer with SQL Server database in application - c#

I am following a nice tutorial titled: Walkthrough: Adding a SQL Server Compact Database to an Application and Deploying it, from MSDN. Since this application will require SQL Server, .NET Framework and SQL Compact to be installed on the machine; I opted for the "Download prerequisites from the same location as my application" because I don't want to assume the user has internet connection.
I went and downloaded the prerequisites software and saved them under:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\Bootstrapper\Packages and placed them in the relevant folders e.g. .NETFramework under its folder etc etc (as suggested in the tutorial).
However! When I click publish now, Visual Studio 2012 Professional displays the following:
"Error 105 To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'SQL Server Compact Edition 4.0\SSCERuntime_x86-ENU.exe' for item 'SQL Server Compact 4.0 SP1' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883. SQLCompactWalkthrough"
And I have already downloaded the prerequisite files and placed them under packages folder. What else could I possibly be missing here?

Tumelo, make sure the prerequisite files you downloaded are indeed the .exe files and not the .msi files.
You can download the .exe files here

Related

C# - Project Deployment (ClickOnce)

I did a project and I used Visual Studio 2017 (Microsoft .NET Framework 4.6.1) - (Windows Form Applications) and SQL Server 2012 Express LocalDB for database operations.
I will run this project on clients' computers. As you can imagine, customers are not interested in database, software, etc. For this purpose, without making any installation on their computers, I'll just make the project work by giving the project file. This is my FIRST comprehensive project.
When I choose deployment attributes in "publish", "prerequisities" I ticked "Microsoft .NET Framework 4.6.1 (x86 and x64) and SQL Server 2012 Express LocalDB and I published it with "Download prerequisites from the component vendor's web site.". I test my software and it works fine.
But when I choose "Download prerequisites from the same location as my application", it fails. I researched it on internet but I couldn't find any clear information. I want the user to download the prerequisites from my software file, so I want to choose "Download prerequisites from the same location as my application". I have "SqlCmdLnUtils.msi", "SqlLocalDB.msi", "sqlncli.msi" for both x86 and x64, and I have "NDP461-KB3102436-x86-x64-AllOS-ENU". I think I need to add the installers on my own computer to be able to do "Download prerequisites from the same location as my application".
But I don't know where I should add these installers in "C: \ Program Files (x86) \ Microsoft SDKs" or "C: \ Program Files (x86) \ Microsoft Visual Studio 14.0 \ SDK".
You are right, you have to download the packages first on your development computer.
By default, the path is %ProgramFiles(x86)%\Microsoft SDKs\ClickOnce Bootstrapper\Packages\
All the steps that are necessary to offer prerequisites from the same location as your application are described here.

How to attach my Microsoft SQL Server 2016 database to installshield project in Visual Studio 2015?

I'm coding a C# Console Application that connects to a database and runs some queries where my database Engine is Microsoft SQL Server 2016 and I code in Visual Studio 2015. I have already installed and activated InstallShield Limited Edition on my visual studio and I'm able to make an installation(setup) file for my C# Console Application.
I don't want to to install Sql Server on my customer's PC and attach the database to that manually, instead I want to give everything in an installation file that includes .Net framework 4.5 and my database. The first part(.Net Framework) is done by InstallShield easily, but I don't know how to attach my database to the installation file.
Please explain how to do this and if any other version of InstallShield(Express, Professional or Premier) is needed let me know and explain the steps in that version.
Note that I want to give the installation file to the customer and make every feature of the app function well after he/she installs the program without needing to do anything manually.
Sql server 2016 cannot be installed automatically as it needs to be configured by the user, he must set the instance names, permissions and so on, which makes it unusable for your scenario.
What you need to use is Sql Server LocalDB, this is a subset of Sql Server Express for your concrete scenario, something which can be installed without the need of configuration and capable of attaching a database file also without user interaction.
You can find information about LocalDB here, as you see it can be downloaded as a .msi, in this way you can add this msi to your installshield project and chain it (more info on how to chain an installer here), it will not ask to the user about complex configurations, just a simple installer. To download the .msi you get the sql server express installer on your development machine and instruct it to download media and select the LocalDB package, that will give you the .msi.
Finally you will add the database file as part of your project files, then you only need to specify on the connection string the path to the file.

Install SQL Server compact database .Exe file automatcally when I install WPF application

I had developed a WPF application, and its backend is a SQL Server CE .SDF file. In setup and deployment project I added .SDF file in it
The issue is: to access and get records from the .SDF file we require an additional software. Please find the below Link
https://www.microsoft.com/en-in/download/details.aspx?id=17876
It has 2 exe files
64 Bit
86/32 Bit
Visual Studio directly installs this software when we install VS
On a client system, I didn't find these files so I am unable to access the .SDF file and get records from it
I need to Copy these files in Application folder and Automatically Install it if the above software is not Present in the PC
Now I am Manually Installing these software(exe ) in Each PC
You're mistaken - to deploy a SQL Server CE 4.0 based application, you do NOT need to deploy and/or install any additional software to your client system - it suffices to include the necessary, relevant SQL Server CE 4.0 DLL's into your application (into the bin or lib folder or something), and just ship those files with your application. That's all you need - no server-side or client-side install needed ! (That's the WHOLE POINT of using SQL Server CE, after all!)
See these links for in-depth descriptions of how to do it:
Right here on Stackoverflow:
How to deploy SQL Server Compact 4.0
Another way to do it:
How to deploy the SQL Server Compact Edition software locally
Official MSDN documentation:
How to deploy a SQL Server Compact 4.0 database with an application

files to include in app deployment

I'm done with a c# application vs2012 and now I need to install it to the client which already has sql server express installed I'm including the appname.exe found in bin/release and the app.config file only. Are these files enough?
I haven't installed any external libraries, but I have a dbml file as I'm using linqtosql, and some images used in the references files should these be included as well.
And just one more thing, should I change anything in the app.config or not necessary since its a db on sql express
Visual studio doesn't need to be installed in the client PC, right?

ClickOnce cannot find its prerequisites while the files are at the place they have to be

I want to publish my application using ClickOnce with some prerequisites (.NET 4.5 and SQL Server Express).
I did as it says in How to: Include Prerequisites with a ClickOnce Application (note that the package folders were at v8.1A folder instead of v8A folder), but it still says it can't find the files. I've tried both Visual Studio 2013 and Visual Studio 2015 RC.
To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'DotNetFX45\dotNetFx45_Full_x86_x64.exe' for item 'Microsoft .NET Framework 4.5 (x86 and x64)' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.
To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'SqlExpress2012\SQLEXPR32_x86_ENU.EXE' for item 'SQL Server 2012 Express' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.
To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'SqlExpress2012\SQLEXPR_x64_ENU.EXE' for item 'SQL Server 2012 Express' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.
To enable 'Download prerequisites from the same location as my application' in the Prerequisites dialog box, you must download file 'DotNetFX40ClientKB2468871\dotNetFx40_Client_x86_x64.exe' for item 'Microsoft .NET Framework 4 Client Profile (x86 and x64) and Update for .NET Framework 4 (KB2468871)' to your local machine. For more information, see http://go.microsoft.com/fwlink/?LinkId=239883.
You have a very wrong idea about what is possible in a ClickOnce deployment. The canonical MSDN page is this one. High-lighting the most significant sections in that web page:
Impact to the user's computer. With Windows Installer deployment, applications often rely on shared components, with the potential for versioning conflicts; with ClickOnce deployment, each application is self-contained and cannot interfere with other applications.
Security permissions. Windows Installer deployment requires administrative permissions and allows only limited user installation; ClickOnce deployment enables non-administrative users to install and grants only those Code Access Security permissions necessary for the application.
Does not affect shared components or other applications: Yes
Installation of shared files: No
Installation to Global Assembly Cache: No
Installation for multiple users: No
Install time registry access: Limited
These intentional restrictions were designed to make users feel good about installing .NET programs with ClickOnce. They don't need assistance from an administrator to get the program installed. And the installer cannot make drastic changes to the machine, the kind that cause other programs to malfunction. A very, very common problem with installers.
This is grossly incompatible with what you are trying to do. Both the .NET Framework and SQL Express are shared components and do require administrator access to install and do risk destabilizing a machine that already has .NET or SQL server installed.
So this simply cannot work. You can select them as Prerequisites but all that happens at install time is that the ClickOnce installer verifies that they are met. In other words, the machine must already have the correct versions of .NET and SQL Express installed. If it doesn't then the deployment will fail and the user gets the dialog that tells him where to download the installer. It is then entirely up to him (or his administrator) to download and run the installer. After which your ClickOnce install completes without trouble.
The deployment wizard is fairly crummy, it should have hidden the radio buttons at the bottom. Only "from the component vendor's web site" is a valid selection for these prerequisites. The bootstrapper .xml file format isn't sophisticated enough to limit the selection.
Only way to get ahead if you want to provide the user with these prerequisites included with the installer is to create a normal MSI installer.
The way I've done this scenario in the past is just to use the built in "publish" features. They seem to work well in my experience.
In the Publish configuration section of your application there is a "Prerequisites" button that you can click and check off .NET Framework and SQL Express, among other things. During the ClickOnce install, it will prompt the user to pull them down from Microsoft before installing your application.

Categories

Resources