7

VS2010に、展開にWebセットアッププロジェクトを使用するプロジェクトがあります。現在、VS2012への移行を検討しており、代替のセットアップルーチンを見つける必要があります。

私が持っている要件:

  • 開発マシン上にデプロイパッケージ/インストーラーを作成するためのワンステップビルド。
  • サーバー上で実行できるセットアッププログラム/ルーチン-VisualStudioを使用できません。
  • VisualStudioとサーバー間の直接の相互作用はありません。RDPセッションを介してセットアップファイルをコピーする必要があります。
  • Webアプリケーション(MVC)とWindowsサービスのセットアップ。できれば単一のインストーラーにバンドルされます(新しい要件は現在、Webセットアッププロジェクトでは解決されません)。
  • セットアップの一部としてEF移行を実行する可能性(現在はカスタムアクションを介して実行されます)。

どこから始めればいいですか?VS2012で改善された公開機能を調べる必要がありますか?Wixを見る必要がありますか?他に何かありますか?

4

1 に答える 1

1

Visual Studio 2012を詳しく調べて、意図したとおりに操作しようとすると、反対ではなく、Webデプロイパッケージを使用することになりました。MSIファイルは作成されませんが、代わりに、ターゲットマシンのIISに簡単にインポートできるzipファイルが作成されます。

Windowsサービスプロジェクトは、Webサイトプロジェクトへの参照として追加されました。このようにして、サービスのバイナリがWebサイトのbinディレクトリに含まれます。Entity Frameworkのmigrate.exeファイルは、binディレクトリからのリンクとして追加されました。これは、それもデプロイされることを意味します。

最後に、project.wpp.targetsファイルをプロジェクトに追加しました。このファイルは、サービスをインストールして開始し、デプロイに含まれるサービスの構成ファイルを取得するために必要なコマンドを実行します。これは私たちにとってはうまくいきましたが、実際にはそれほどエレガントではありません(たとえば、さまざまな構成のサイトのインストールパスがハードコーディングされています)。

project.wpp.targetsファイル:

<?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>
于 2013-02-01T13:14:40.887 に答える