Thank you for your responses. I fixed all the time, tried my best to enable assembly and migration for my database (migrator.net), but I cheated and did it through runcommand.
It seemed to me that I am posting the entire deployment process here so that the people who read this post can find out about all my mistakes. The main steps:
- Web.config is converted to ensure that all settings are correct for each client.
- Backing up files and web server databases on a production server
- Exclude all gfx directories for all clients
- Turn on gfx-dir, which this client needs.
- Include additional binaries and license files that are not referenced by project compliance
- Migrating the database to the current version
- Webdeploy of all new files
Deploy.proj, imported <Import Project="Deploy.csproj" /> in the last line of the web project project project:
<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 someone gets some help and examples from this post.
source share