Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/installation/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Installation 在VS2012中创建MSI的Web安装程序替换?_Installation_Visual Studio 2012_Web Setup Project - Fatal编程技术网

Installation 在VS2012中创建MSI的Web安装程序替换?

Installation 在VS2012中创建MSI的Web安装程序替换?,installation,visual-studio-2012,web-setup-project,Installation,Visual Studio 2012,Web Setup Project,我在VS2010中有一个项目,它使用Web安装项目进行部署。我现在正在考虑将它迁移到VS2012,并且必须找到一个替换的安装例程 我的要求是: 在开发人员计算机上创建部署包/安装程序的一步构建 可以在服务器上运行的安装程序/例程-不提供Visual Studio Visual Studio与服务器之间没有直接交互。我必须通过RDP会话复制安装文件 安装web应用程序(MVC)和Windows服务,最好捆绑在一个安装程序中(新要求目前无法解决din web安装项目) 作为安装的一部分运行EF迁移

我在VS2010中有一个项目,它使用Web安装项目进行部署。我现在正在考虑将它迁移到VS2012,并且必须找到一个替换的安装例程

我的要求是:

  • 在开发人员计算机上创建部署包/安装程序的一步构建
  • 可以在服务器上运行的安装程序/例程-不提供Visual Studio
  • Visual Studio与服务器之间没有直接交互。我必须通过RDP会话复制安装文件
  • 安装web应用程序(MVC)和Windows服务,最好捆绑在一个安装程序中(新要求目前无法解决din web安装项目)
  • 作为安装的一部分运行EF迁移的可能性(目前通过a完成)

我应该从哪里开始?我应该看看VS2012中改进的发布功能吗?我应该看看Wix吗?还有别的吗?

深入了解Visual Studio 2012,并尝试按照预期的方式使用它,而不是使用web部署包。它不创建MSI文件,而是可以轻松导入目标计算机上IIS的zip文件

Windows服务项目已添加为对网站项目的引用。这样,服务的二进制文件就包含在网站的bin目录中。实体框架中的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>

真的
$(在将设置和文件内容添加到源清单之后);
运行迁移;
服务安装;
真的
$(在添加ContentPathToSourceManifest之前);
服务卸载;
c:\inetpub\wwwroot\SysTest\
c:\inetpub\wwwroot\IntTest\
c:\inetpub\wwwroot\
IncludeServicesAppConfig;
$(将所有文件复制到SingleFolderForpPackageDependson);
$(DeploymentDir)bin\migrate.exe/startupdirectory:$(DeploymentDir)bin Topsi.Core.dll/startUpConfigurationFile:$(DeploymentDir)web.config
1.
60000
真的
等待间隔;等待尝试;顿图塞科曼德克斯酒店
净停止“Topsi计划服务$(配置)”
1.
60000
真的
等待间隔;等待尝试;顿图塞科曼德克斯酒店
C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe/u$(DeploymentDir)bin\Topsi.Services.exe
1.
60000
真的
等待间隔;等待尝试;顿图塞科曼德克斯酒店
C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe$(DeploymentDir)bin\Topsi.Services.exe
1.
60000
真的
等待间隔;等待尝试;顿图塞科曼德克斯酒店
净启动“Topsi计划服务$(配置)”
1.
60000
真的
等待间隔;等待尝试;顿图塞科曼德克斯酒店
%(RecursiveDir)%(文件名)%(扩展名)
bin\%(递归目录)%(文件名)%(扩展名)

WiX是瑞士军刀式安装程序,但不幸的是,开发和维护WiX安装程序需要大量工作。如果您的安装程序要求无法通过其他工具解决,请作为最后手段使用。以下是一个列表,可以帮助您开始: