Thanks for both your answers. I fixed everything now, struggled alot with including a build and migration for my database (migrator.net) but I cheated and did it through the runcommand instead.
I thought I post my whole deployment process here so people who read this post might learn from all my misstakes.
The basic steps are:
- Web.config transforms to make sure all settings are correct for each of the clients
- Backup of webserver files and database at the production server
- Exclude all gfx directories for all clients
- Include the gfx dir which is wanted by this client
- Include extra binares and license-files which are not referenced by the project correclty
- Migrate the database to the current revision
- Webdeploy all the new files
Deploy.proj, imported by <Import Project="Deploy.csproj" />
at the last line of the webproject project file:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
ExcludeAllGfx;
Client1Backup;
Client1Include;
Client1Migrate;
CollectBinFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
</PropertyGroup>
<Target Name="ExcludeAllGfx" BeforeTargets="ExcludeFilesFromPackage">
<ItemGroup>
<ExcludeFromPackageFiles Include="gfx\client1\**\*.*">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
<ExcludeFromPackageFiles Include="gfx\client2\**\*.*">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
<ExcludeFromPackageFiles Include="gfx\client3\**\*.*">
<FromTarget>Project</FromTarget>
</ExcludeFromPackageFiles>
</ItemGroup>
<Message Text="ExcludeFromPackageFiles: @(ExcludeFromPackageFiles)" Importance="high" />
</Target>
<Target Name="CollectBinFiles">
<ItemGroup>
<_CustomFiles Include="..\IncludeBin\Telerik\Telerik.ReportViewer.WebForms.dll" />
<_CustomFiles Include="..\IncludeBin\Telerik\Telerik.Reporting.dll" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>Bin\%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="Client1Migrate" Condition="'$(Configuration)|$(Platform)' == 'Release Client1|AnyCPU'">
<Exec Command=""..\MigratorProject\Bats\Client1.bat"" ContinueOnError="false" />
</Target>
<Target Name="Client1Include" Condition="'$(Configuration)|$(Platform)' == 'Release Client1|AnyCPU'">
<ItemGroup>
<_CustomFilesClient1 Include="gfx\Client1\**\*.*" Exclude="gfx\Client1\**\.svn\**\*.*">
<FromTarget>Project</FromTarget>
</_CustomFilesClient1>
<FilesForPackagingFromProject Include="%(_CustomFilesClient1.Identity)">
<DestinationRelativePath>gfx\client1\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<Target Name="Client1Backup" Condition="'$(Configuration)|$(Platform)' == 'Release Client1|AnyCPU'">
<Exec Command=""C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync -source:contentPath="page of client1",computerName=http://10.8.1.1/MsDeployAgentService2,encryptPassword=pass -dest:package=c:\Backups\deployments\client1.zip,computerName=http://10.8.1.1/MsDeployAgentService2,encryptPassword=pass" ContinueOnError="false" />
<Exec Command=""C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync -source:runCommand='C:\Backups\deployments\scripts\backup.cmd client1',waitInterval=20000 -dest:auto,computerName=http://10.8.1.1/MsDeployAgentService2,encryptPassword=pass" ContinueOnError="false" />
</Target>
</Project>
Backup.cmd:
@echo off
sqlcmd -v name=%1 -S . -i "C:\Backups\deployments\scripts\backupdb.sql"
C:\Backups\deployments\scripts\stampme "C:\Backups\deployments\%1.zip"
backupdb.sql:
DECLARE @name NVARCHAR(50) -- database name
DECLARE @path NVARCHAR(256) -- path for backup files
DECLARE @fileName NVARCHAR(256) -- filename for backup
DECLARE @fileDate NVARCHAR(20) -- used for file name
SET @name = '$(name)'
SET @path = 'C:\Backups\deployments\'
SELECT @fileDate = REPLACE(REPLACE(CONVERT(VARCHAR(50),GETDATE(),120),':','-'), ' ', '@')
SET @fileName = @path + @name + '_' + @fileDate + '.BAK'
BACKUP DATABASE @name TO DISK = @fileName;
stampme.bat: http://ss64.com/nt/syntax-stampme.html
Hope anyone gets some help and examples from this entry.