2012-09-13 21 views
7

VS2010'da, dağıtım için Web Kurulum projeleri kullanan bir projem var. Şimdi VS2012'ye geçmeyi düşünüyorum ve yedek bir kurulum rutini bulmak zorundayım.Web Kurulumu, VS2012'de MSI oluşturmak için nasıl değiştirilir?

gereksinimleri Ben: Bir dev makinede bir dağıtma paketi/yükleyici oluşturmak için

  • Tek aşamalı yapı.
  • Sunucuda çalıştırılabilecek program/yordam - Visual Studio'yu kullanmadan.
  • Visual Studio ve sunucu arasında doğrudan etkileşim yok. Kurulum dosyalarını bir RDP oturumu üzerinden kopyalamam gerekiyor.
  • Web uygulamalarının (MVC) ve Windows Hizmetlerinin kurulumu, tercihen tek bir yükleyicide (yeni gereksinim şu anda din Web Kurulumu projesini çözmez) paketlenmiştir.
  • Kurulumun bir parçası olarak EF Geçişlerini çalıştırma olasılığı (şu anda custom action aracılığıyla gerçekleştirilmiştir).

Nereden başlamalıyım? VS2012'deki geliştirilmiş yayınlama özelliklerine bakmalı mıyım? Wix'e bakmalı mıyım? Başka bir şey?

+0

WiX montajcılar İsviçre Çakısı, fakat maalesef WiX yükleyici geliştirmek ve korumak için iş biraz gerektirir. Yükleyici gereksinimleriniz başka bir araçla çözülemezse son çare olarak kullanın. –

+0

Başlayabileceğiniz bir liste: http://en.wikipedia.org/wiki/List_of_installation_software –

cevap

1

Visual Studio 2012'ye daha ayrıntılı bir şekilde bakmak ve onunla birlikte çalışmak yerine, bunun yerine çalışmayı denemek için web dağıtımı paketlerini kullanarak sonuçlandırdık. Bir MSI dosyası oluşturmaz, bunun yerine hedef makinede IIS'ye kolayca aktarılabilen bir zip dosyası.

Windows hizmet projesi, web sitesi projesine başvuru olarak eklendi. Bu şekilde hizmet için ikili dosyalar, web sitesinin bin dizinine dahil edilir. Entity çerçevesindeki migrate.exe dosyası, bin dizinden de dağıtıldığı anlamına gelen bir bağlantı olarak eklendi.

Son olarak, projeyi yüklemek ve başlatmak ve dağıtımda bulunan hizmetin yapılandırma dosyasını almak için gerekli komutları çalıştıran projeye bir project.wpp.targets dosyası ekledik. Bu bizim için çalıştı, ama gerçekten o kadar da zarif değil (örneğin farklı konfigürasyonlar için sitenin kurulum yolları sabit kodlanmış).

project.wpp.targets dosyası:

<?xml version="1.0" encoding="utf-8" ?> 
<!-- 
*** WARNING *** 
This file is cached by visual studio and changes won't take effect until 
visual studio is restarted. When editing this file, it is better to run the 
build step for packaging from the command line (a VS command prompt). 
There are some problems with dependencies not being correctly identified that 
way, but at least the archive.xml file can be verified from the command prompt. 

msbuild orderportal.csproj /t:package /p:Configuration=SysTest /p:DeployOnBuild=true;DeployTarget=Package 
--> 

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 
    <PropertyGroup> 
    <IncludeRunMigrations>TRUE</IncludeRunMigrations> 
    <AfterAddIisSettingAndFileContentsToSourceManifest Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)'==''"> 
     $(AfterAddIisSettingAndFileContentsToSourceManifest); 
     RunMigrations; 
     ServiceInstall; 
    </AfterAddIisSettingAndFileContentsToSourceManifest> 

    <IncludeServiceInstall>TRUE</IncludeServiceInstall> 
    <BeforeAddContentPathToSourceManifest Condition="'$(BeforeAddContentPathToSourceManifest)' == ''"> 
     $(BeforeAddContentPathToSourceManifest); 
     ServiceUnInstall; 
    </BeforeAddContentPathToSourceManifest> 

    <DeploymentDir Condition="'$(Configuration)'=='SysTest' AND '$(DeploymentDir)'==''">c:\inetpub\wwwroot\SysTest\</DeploymentDir> 
    <DeploymentDir Condition="'$(Configuration)'=='IntTest' AND '$(DeploymentDir)'==''">c:\inetpub\wwwroot\IntTest\</DeploymentDir> 
    <DeploymentDir Condition="'$(Configuration)'=='Prod' AND '$(DeploymentDir)'==''">c:\inetpub\wwwroot\</DeploymentDir> 

    <CopyAllFilesToSingleFolderForPackageDependsOn> 
     IncludeServicesAppConfig; 
     $(CopyAllFilesToSingleFolderForPackageDependsOn); 
    </CopyAllFilesToSingleFolderForPackageDependsOn> 

    </PropertyGroup> 
    <Target Name="RunMigrations" Condition="'$(IncludeRunMigrations)' == 'TRUE'"> 
    <Message Text="Adding migration running"/> 
    <ItemGroup> 
     <MsDeploySourceManifest Include="runCommand"> 
     <path>$(DeploymentDir)bin\migrate.exe /startupdirectory:$(DeploymentDir)bin Topsi.Core.dll /startUpConfigurationFile:$(DeploymentDir)web.config</path> 
     <waitAttempts>1</waitAttempts> 
     <waitInterval>60000</waitInterval> 
     <dontUseCommandExe>true</dontUseCommandExe> 
     <AdditionalProviderSettings>waitInterval;waitAttempts;dontUseCommandExe</AdditionalProviderSettings> 
     </MsDeploySourceManifest> 
    </ItemGroup> 
    </Target> 

    <Target Name="ServiceUnInstall" Condition="'$(IncludeServiceInstall)' == 'TRUE'"> 
    <Message Text="Adding service uninstall" /> 
    <ItemGroup> 
     <MsDeploySourceManifest Include="runCommand"> 
     <path>net stop "Topsi Schedule Service $(Configuration)"</path> 
     <waitAttempts>1</waitAttempts> 
     <waitInterval>60000</waitInterval> 
     <dontUseCommandExe>true</dontUseCommandExe> 
     <AdditionalProviderSettings>waitInterval;waitAttempts;dontUseCommandExe</AdditionalProviderSettings> 
     </MsDeploySourceManifest> 
     <MsDeploySourceManifest Include="runCommand"> 
     <path>C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe /u $(DeploymentDir)bin\Topsi.Services.exe</path> 
     <waitAttempts>1</waitAttempts> 
     <waitInterval>60000</waitInterval> 
     <dontUseCommandExe>true</dontUseCommandExe> 
     <AdditionalProviderSettings>waitInterval;waitAttempts;dontUseCommandExe</AdditionalProviderSettings> 
    </MsDeploySourceManifest> 
    </ItemGroup> 
    </Target> 
    <Target Name="ServiceInstall" Condition="'$(IncludeServiceInstall)' == 'TRUE'"> 
    <Message Text="Adding service install"/> 
    <ItemGroup> 
     <MsDeploySourceManifest Include="runCommand"> 
     <path>C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe $(DeploymentDir)bin\Topsi.Services.exe</path> 
     <waitAttempts>1</waitAttempts> 
     <waitInterval>60000</waitInterval> 
     <dontUseCommandExe>true</dontUseCommandExe> 
     <AdditionalProviderSettings>waitInterval;waitAttempts;dontUseCommandExe</AdditionalProviderSettings> 
     </MsDeploySourceManifest> 
     <MsDeploySourceManifest Include="runCommand"> 
     <path>net start "Topsi Schedule Service $(Configuration)"</path> 
     <waitAttempts>1</waitAttempts> 
     <waitInterval>60000</waitInterval> 
     <dontUseCommandExe>true</dontUseCommandExe> 
     <AdditionalProviderSettings>waitInterval;waitAttempts;dontUseCommandExe</AdditionalProviderSettings> 
     </MsDeploySourceManifest> 
    </ItemGroup> 
    </Target> 
    <Target Name="IncludeServicesAppConfig"> 
    <ItemGroup> 
     <_CustomFiles Include="..\Services\bin\$(Configuration)\Topsi.Services.exe.config"> 
     <DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> 
     </_CustomFiles> 

     <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)"> 
     <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath> 
     </FilesForPackagingFromProject> 
    </ItemGroup> 
    </Target> 
</Project> 
İlgili konular