This has taken us some time; depending on which environment you are, telling Visual Studio 2008 for Database Professionals Edition (or simply DataDude) what user it should use to deploy the SQL scripts, during an automated build. We're working with Windows XP users, Windows Vista users and Windows 2008 Server. As you might now, XP uses the "ASPNET" user to run IIS and Vista and 2008 use the "Network Service" user.
We're using FinalBuilder, a most excellent product, which in turn is using MSBuild and were trying to figure out how to pass variables to MSBuild, who should pass them to DataDude, which in turn would have to pass them to SQLCommand. Sounds difficult, but when you've figured it out, it's quite easy! :-)
The goal is to use "Network Service" when automated and let the user specify what user to use when running locally.
Here are the steps we took
<PropertyGroup Condition=" '$(Configuration)' == 'Default' ">
<SetVariables>
<Variable Name="TargetUser" Value="ASPNET" />
</SetVariables>
</PropertyGroup>
<Variable Name="TargetUser" Value="$(DatabaseUser)" />
<DatabaseUser>aspnet</DatabaseUser>
If you're interested how to use this in FinalBuilder, here's how.
Good luck! :-)