Darren Oster
Darren Oster

Reputation: 9196

Can I call ASP.NET RegSQL from code?

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.

Upvotes: 4

Views: 704

Answers (1)

Rex M
Rex M

Reputation: 144162

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 (' ').

Upvotes: 4

Related Questions