views:

253

answers:

1

Is it possible to call (the equivalent of) aspnet_regsql.exe from managed code? My idea is to create a class to automagically build the database for an installed web app, which uses the ASP.NET Membership provider. I could probably call aspnet_regsql.exe direct from code, but I came across the RegSql class(http://msdn.microsoft.com/en-us/library/ms229567.aspx) - unfortunately it doesn't seem to have any methods...

Thanks in advance.

+1  A: 

The RegSql class lives inside aspnet_regsql.exe. It's the entry point for the console application, so it has a static Main(string[]) method.

Following the usage instructions for aspnet_regsql we can pass it the parameters it expects. (something like "-S localhost -U user -P password"). Input parameters are split by a space (' ').

Rex M
Thanks for that. I missed the Main method. Input parameters can also be in a string array (new string[] { "-S", "localhost", ...})
Darren Oster