Speed Up with Project Templates Using Visual Studio 2005 - Part 3
page 4 of 10
by Ameet Phadnis
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 38010/ 61

aspnet_regsql.exe wizard

This wizard will display various screens to get information from the user to create the tables and stored procedures.  In our scenario we would like to automate this procedure and not display all these screens.  In order to do this, we need to look at the various options of aspnet_regsql.exe

Figure 1


Will run in Wizard Mode


Connection String to the computer running SQL Server where the database will be installed.  You can also specify -S and login parameters and not use this option.


The name of the computer running SQL Server where the database will be installed.


The SQL Server User ID to login with


The password to login with


Authenticates using the Windows credential


The database to create or modify

-A all|m|r|p|c|w

What all support needs to be added

 Options are

All - All features

M - Membership

R - Role Management

P - Profile

C - Web Parts Personalization

W - Web Events

- R all|m|r|p|c|w

Removes support for specified feature

- Q

Runs the tool in Quiet Mode and does not confirm before removing any feature

In order to create our database with all features, you will use the following command:

Listing 2

aspnet_regsql.exe -S<servername> -E -d<databasename> -A all 

In order to call this command we will use the Shell function. The syntax will be the following code.

Listing 3

Shell("C:\Windows\system32\cmd.exe /C
 C:\WINDOWS\Microsoft.Net\Framework\v2.0.50727\aspnet_regsql.exe -S
 """ & txtServer.Text & """ -E -d
 """ & txtDatabase.Text & """ -A
 all", AppWinStyle.Hide)

The AppWinStyle.Hide will make sure that we do not see the command window popup and go away.

View Entire Article

User Comments

Title: Clarification   
Name: Jon
Date: 2007-01-09 3:34:33 PM
As a clarification, VS will still use the old version even after I go into the cache through the control panel and remove it.
Title: Development Process   
Name: Jon
Date: 2007-01-09 3:32:22 PM
What's the best way to actually build and test a wizard from the ground up?

I have my build process for the Wizard's project set up to sign the DLL and automatically add itself to the GAC (using: "gacutil.exe /if $(TargetPath)").

The problem is they will stay in the cache after every rebuild, so I need to either update the version number in the vsTemplate file and the project after each compile, or restart Visual Studio each time I want to test a new build.

Title: VB Bug ?   
Name: frisla
Date: 2006-09-20 9:52:51 AM
Hi A

The test for C# and VB.NET wore created as separated projects - C# Custom wizard and template project, VB Custom wizard and template project.

In VB as soon as I try to access my IWizard implementation, my VB template project wil not unfold, hence the error message. The template itself executes perfectly, but again as soon as I try to reference my custom wizard, using an "WizardExtension" entry in the xx.vstemplate I get the error message.

Any suggestions

- Thanks -
Title: No   
Name: Ameet
Date: 2006-09-19 7:37:26 PM
The article was written using VB.NET and not C#.NET.

Check whether you have created the template itself for C#.NET...
Title: VB Bug ?   
Name: frisla
Date: 2006-09-19 4:01:54 PM
Why is it you get a, "Unable to copy the file 'Application.myapp' from the project template to the project. Cannot find file ...." failure when you use VB.NET (2005), but using C# is a walk in the park ??????

Is the execution of the IWizard interface different in VB.NET ?????

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-06-22 10:28:34 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search