Attach and configure ms sql server database using installation package - installation

i have some Db steps (attach database, adding and configure a new login, configure roles) and i want to automize it using installation package. Right now in project we are using standard Visual studio installer. Can i implement db steps using standard visual studio intaller (custom actions or something else)? Or maybe i should use some others installers like Install shield, Wix?

As far as I know Visual Studio setup project doesn't offer this functionality out of the box (although, my experience with it is tiny). Also, it is not a good idea to implement it all from scratch in a custom action - it is really the last resort.
Other vendors, at least those you mentioned, do offer this. if you decide to move to one of those, keep in mind the learning curve, which will take some of your time (for WiX is probably more). However, if the VS setup project is quite small and simple, it might be a good idea to move at this point, considering the fact that VS setup project type was deprecated by Microsoft.

For DB configuration you may create SQL script which can be installed with an application or into temp directory and feed it to whatever consumes sql scripts in mssql (in oracle its sqlplus). Not sure about visual studio but that's how I saw in one project for InstallShield.

Related

Difference between Wix and Visual Studio installer

I'm developing a Visual Studio application with WPF, but right now is the moment where I have to choose my installer.
I need my project to be able to write on the GAC and on registry, but I'm not sure if I should use Visual Studio installer or Wix... I can't find on Google information that says exactly the differences between both of them.
I found that Wix is more complete, but I can't find any article that specifies real differences between one or another...
Can anyone help me to find more specific information or to choose between both of them?
EDIT: Sorry, I specify:
I'm using Visual Studio 2010 professional.
The end product is the same, a windows installer msi.
It's just different how you get there. With the old vdproj there wasn't much other than setting up files to be copied and registry keys as far as I remember. Anything else and you would have to create a custom action in C++ or VBS, not a particularly easy task if you are .net developer.
However with the advent of Wix there are a lot more in-built custom actions which enable you to create a rich installation experience and if you need to create your own custom action you can use .net. Also it is much easier to create a bootstrapper which can install dependencies along with your msi as well as being able to create a front-end in WPF.
As #nvoigt said the old vdproj type is not supported in VS2012 and it also cannot be built by a build server without doing some nasty setup (you have to install VS).
All in all there really should be no question of what to use, Wix is the way forward.
Caveman_Dick wrote:
"Anything else and you would have to create a custom action".
And that in a nutshell is the difference. Visual Studio Deployment Projects heavily abstracts you from the underlying windows installer and seals away a great deal of it's ability. This goes against the very design of Windows Installer which is supposed to be a declarative, transactional programming model.
Take installing a Windows Service as an example? Windows Installer has the ServiceInstall table. VDPROJ fails to expose this so you are off writing brittle custom actions resulting in a less elegant and less robust installer.
WiX on the other hand is a very thin abstraction. It's all about XML XSD elements and attributes that represent the underlying Windows Installer table data. The build process simply transforms the XML to SQL tables. If MSI can do it, WiX can (99%) do it.
VDPROJ was a horrible mistake and Microsoft has finally owned up to it and killed it. Now WiX doesn't have UI designers ( I've written one on CodePlex though) so you might also want to consider InstallShield Limited Edition (FREE).
Using a combination of ISLE and WiX I can get the best of both worlds.
With Setup projects no longer shipped with current versions of Visual Studio, you might want to use Wix. Otherwise, you will have to write it again once you switch to a current version of Visual Studio.

Customize deploy scripts for Visual Studio 2010 Database project

The deployment scripts generated by a visual Studio 2010 Database project won't work for me. I need to include them in an MSI that will be shipped to many different customers to both upgrade and create new databases.
Looking through the Microsoft.Data.Schema... namespaces I see many possibilities for customizing the generation of the deployment scripts, DeploymentScriptGenerator, ExtensionManager etc. etc. It really looks like it was designed to be extensible and to support any database.
What I can't find is any sort of "getting started" documentation or samples. Has anyone done something like this?
Visual Studio Data Projects use two phases of deployment.
The deployment files created by building the database project is really just a package of metadata that describes the desired final state of of the database, but with no knowledge of where is going to be deployed or whether it is a new database or existing database.
The second part is actually executing the deployment package against a specific database, either existing or new. To do that, Visual Studio has to run a diff against the database and the deployment package, and determine which changes need to be applied, and generate the script necessary to apply those changes.
So the problem you have is that if you include the first part in your MSI, you need something running on the end user's machine to apply those changes to an unknown number of unknown databases out in the field, and you can't really ship them Visual Studio.
Luckily MS includes a command line too (VSDBCMD.exe) which allows you to take that single deployment package and use it to apply changes to any database. This tool will do the same diff as Visual Studio and generate the SQL script necessary to create/upgrade that database (any actually run the script, if you so choose, based on command line parmaeters). See http://msdn.microsoft.com/en-us/library/dd193283.aspx for information about how to call it from the command line.
So I'd saw you ship that command line tool with your application (just make sure to double check the redistribution license to make sure this is OK) and have a custom action in your MSI (or some other utility) that executes it to apply the database changes. And also check the dependencies for the command line tool, I know it requires the SQL SMO objects, SQL Native Client, and probably a few other things. You'll want to make sure you MSI includes those as prerequisites.

Upgrade VS2010 Professional to Premium or Ultimate

I have VS2010 Professional installed
A client has recently asked me to add a Database project to the solution for the creation and deployment of databases (only available with Premium or Ultimate)
Can I buy an upgrade to the current license? if so Where?
Or can I get the Database project templates some other way and use them with Professional?
Thanks
IMHO, database projects are not worth it. I would strongly suggest you create your databases using a script, which you can easily add to your solution and which can be versioned and checked into source control just like any other type of file.
If you are resigned, you definitely need Premium or Ultimate in order to open and use a database project. No plugin or template will change this.
You can upgrade from Microsoft or a reseller. I believe it comes with an MSDN license, which means the path can be steep (maybe 2-2.5k for premium and upwards of 10k for ultimate).
Actually, back in '11 they were pretty bad. They are definitely improving. I'm using one now for a website that publishes to Azure. In this form, they are pretty damned convenient. The tooling is still lacking in 2012. Hopefully in 2013 you'll be able to, for example, add foreign keys using the toolset instead of writing sql.

Why use Windows Installer XML (WiX) over VDPROJ?

Why should one go for Windows Installer XML (WiX) when we have in built .net MSI installer?
It would take me hours to rant about everything I hate about VDPROJ. I won't because in my (expert) opinion it's already settled law that VDPROJ sucks. If your install is so simple that you haven't noticed any problems, then be my guess and stick with it. But if you already find yourself fighting the tool trying to get it to do things it doesn't do, then take my advice and dump it fast for WiX.
10 things I hate about VDPROJ
No MSBuild Support. Sure, you can call devenv from the command
line but it's not as good.
No exposing of the critical concept of
a component. Every file/reg key is a keyfile of it's own component.
No effective way to fully exclude automatic dependency scanning.
Shortcuts are always Advertised
No way to describe a service.
No way to describe many things which leads to overuse of custom
actions.
No way to fine control the scheduling / execution of
custom actions. Too abstracted.
Abstraction is wrong. Deferred
CA's are scheduled with Impersonation which breaks on Vista.
Various limitations lead you down a path of massaging the built MSI
during postbuild to get around all the limiations. Results in a
very poor build automation hacks.
Merge Module directory tables
are authored incorrectly.
100 other things suck that I'm not
remembering right now.
The introduction of WiX tutorial gives the basic idea about WiX advantages comparing to other setup development tools (including VS setup projects):
declarative approach
unrestricted access to Windows
Installer functionality
source code instead of GUI-based
assembly of information
complete integration into application
build processes
possible integration with application
development
support for team development, both
in-house and third-party
free, open source
Hope this helps.
Visual Studio deployment packages can only be built by visual studio. They cannot be built using plain MSBuild command lines, which makes them less than ideal for e.g. build servers.
All the above answers have included most of the annoying features of Visual studio setup projects (.VDPROJ), one thing that most people have missed.
.VDPROJ file format is such that, and if we make a small
change to one single entry it completely rewrites all the entries
within which makes it impossible to merge changes from 2 different
branches.
Some of us don't want to use / can't use the .NET installer.
Some of us don't want to have to install Visual Studio to distribute a program, written in, say, Borland Delphi. WiX and .NET have nothing to do with one another.
WiX provdes a much more complete feature set than the .NET installer.

How can I setup the VB project?

Using VB6
I want to setup the Project, Last time I used VB 6 Package and Deployment wizard. It asks to modify some system file. I modified my system file, and then it worked. Now again I want to setup my new project, is asking to change the system file.
Once I set up the project, is asking to change the system file and crystal report files (like crystl32.ocx… etc)
Is showing error like, “out of stack space”, “out of system date” etc...
Why is always asking to change?
What is best way to setup a vb project? If there is any software is available for setup a project.
Always am getting a problem for setup a VB 6 project, please Can any one help to solve my problem?
I've been using Advanced Installer (for VB.NET projects, but that doesn't matter), the free version is very capable and easy to use.
But to answer your question, sounds like the package wizard has got itself in a bad state. I'd re-install VB6 in that case.
In my experience the VB6 Package and Deployment wizard is pretty useless. I recommend you look at commercial installation software like InstallShield or Wise.
If you have Visual Studio 2002 or above, you could also try hacking a .NET setup project to install your VB6 components. It is capable of self-registering COM binaries, creating Start menu shortcuts, etc.
Have a look at the answers to these questions
What is the best simple install system [for VB6 programs] on Windows XP and Vista
What is the best choice for building windows installers
Do you have a copy of Visual Studio? You can use that to create installers instead.
You may use some other thirdparty software like installshield to create the setups. As far as I see they are much flexible.
Wise installer is one of other similar products.
Microsoft is now offering a replacement for the Package and Deployment Wizard that may help you out. Visual Studio Installer

Resources