After days of messing with it, i got my web deployment project to do what i want. It compiles the site, makes a copy, modified the web.config in the copy to point to a different database, zips up the copy and deletes the copy folder leaving only the zip file behind. It then does the same thing for production. But, i feel that my solution is kind of backwards, mainly because i have the connection strings hardcoded. Can you please look at my AfterBuild section and let me know if it's good, or should be changed?
<Target Name="AfterBuild">
<Exec Command="del "$(MSBuildProjectDirectory)\Release\*.csproj", "$(MSBuildProjectDirectory)\Release\*.user", "$(MSBuildProjectDirectory)\Release\*.vspscc"" />
<Exec Command="xcopy /y /e "$(MSBuildProjectDirectory)\Release" "$(MSBuildProjectDirectory)\Production\"" />
<XmlUpdate Namespace="http://schemas.microsoft.com/.NetConfiguration/v2.0"
XmlFileName="$(MSBuildProjectDirectory)\Production\web.config"
Xpath="//configuration/connectionStrings/add[@name='MySqlProviderConnection']/@connectionString"
Value="###" />
<CreateItem Include="$(MSBuildProjectDirectory)\Production\**" Exclude="">
<Output ItemName="ProductionZipFiles" TaskParameter="Include" />
</CreateItem>
<Zip ZipFileName="production.zip" WorkingDirectory="$(MSBuildProjectDirectory)\Production" Files="@(ProductionZipFiles)" />
<Exec Command="rmdir /s /q "$(MSBuildProjectDirectory)\Production\"" />
<Exec Command="xcopy /y /e "$(MSBuildProjectDirectory)\Release" "$(MSBuildProjectDirectory)\Staging\"" />
<XmlUpdate Namespace="http://schemas.microsoft.com/.NetConfiguration/v2.0"
XmlFileName="$(MSBuildProjectDirectory)\Staging\web.config"
Xpath="//configuration/connectionStrings/add[@name='MySqlProviderConnection']/@connectionString"
Value="###" />
<CreateItem Include="$(MSBuildProjectDirectory)\Staging\**">
<Output ItemName="StagingZipFiles" TaskParameter="Include" />
</CreateItem>
<Zip ZipFileName="staging.zip" WorkingDirectory="$(MSBuildProjectDirectory)\Staging" Files="@(StagingZipFiles)" />
<Exec Command="rmdir /s /q "$(MSBuildProjectDirectory)\Staging\"" />
</Target>