创建的ClickOnce webdeploy包ClickOnce、webdeploy

2023-09-03 16:27:06 作者:那年夏天

是否有可能建立一个包含了可以使用标准的webdeploy工具被部署到Web服务器ClickOnce应用程序的Web部署包?

Is it possible to build a web deploy package containing a clickonce application that can be deployed to a web server using the standard webdeploy tool?

下面将是理想的过程:

在MSBuild的YourFullyQualifiedProjectName.csproj / vbproj/ T:包装 OBJ \调试\包装\ YourFullyQualifiedProjectName.deploy.cmd / Y

这背后的理由是,所以我们可以生成整个解决方案包括网络包,运行所有测试,然后部署测试通过后才能使用。

The reasoning behind this would be so we can build the whole solution including web packages, run all tests, then deploy only after tests pass.

目前我已经看了做一个基于文件的部署到一个临时文件夹,复制到一个web项目,然后打包Web项目。有一个整齐的解决方案?

I've currently looked at doing a file-based deploy to a temp folder, copy that into a web project, then package the web project. Is there a neater solution?

推荐答案

我创建了一个博客,这在http://sedodream.com/2012/02/18/HowToCreateAWebDeployPackageWhenPublishingAClickOnceProject.aspx其中有更多详细信息,但相关件低于

I have created a blog for this at http://sedodream.com/2012/02/18/HowToCreateAWebDeployPackageWhenPublishingAClickOnceProject.aspx which has more details, but the relevant pieces are below

如果您有您要创建的ClickOnce包出来的,那么你可以尝试在客户端的项目如下。

If you have a client project which you want to create a ClickOnce package out of then you can try the following.

编辑项目文件为您的客户端项目,并添加下面的底部(右&LT以上; /项目> 标记)。

Edit the project file for your client project and add the following at the bottom (right above the </Project> tag).

  <PropertyGroup>
    <!--Unless specified otherwise, the tools will go to HKLM\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1 to get the installpath for msdeploy.exe.-->
    <MSDeployPath Condition="'$(MSDeployPath)'==''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3@InstallPath)</MSDeployPath>
    <MSDeployPath Condition="'$(MSDeployPath)'==''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2@InstallPath)</MSDeployPath>
    <MSDeployPath Condition="'$(MSDeployPath)'==''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\1@InstallPath)</MSDeployPath>
    <MSDeployExe Condition=" '$(MSDeployExe)'=='' ">$(MSDeployPath)msdeploy.exe</MSDeployExe>
  </PropertyGroup>

  <Target Name="CreateWebDeployPackage" AfterTargets="Publish" DependsOnTargets="Publish">
    <!--
    %msdeploy% 
      -verb:sync 
      -source:contentPath="C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\app.publish" 
      -dest:package="C:\Temp\_NET\WebPackageWithClickOnce\WebPackageWithClickOnce\bin\Debug\co-pkg.zip"
      -->
    <PropertyGroup>
      <Cmd>"$(MSDeployExe)" -verb:sync -source:contentPath="$(MSBuildProjectDirectory)\$(PublishDir)" -dest:package="$(OutDir)cotest.zip"</Cmd>
    </PropertyGroup>

    <Message Text="Creating web deploy package with command: $(Cmd)" />
    <Exec Command="$(Cmd)" />
  </Target>

在的PropertyGroup我:

In the PropertyGroup I am:

宣布网络部署软件包的名称 想看看在安装MSDeploy

在所定义的CreateWebDeployPackage将得到PublishOnly目标后执行(,因为AfterTargets =PublishOnly的的)。这目标将打电话到msdeploy.exe创建包的输出目录。您应该能够采取这种包并发布它,就像任何其他的包。

After that the CreateWebDeployPackage is defined which will get executed after the PublishOnly target (because of AfterTargets="PublishOnly"). That target will make a call to msdeploy.exe to create the package in the output directory. You should be able to take that package and publish it as you would any other package.

您可以尝试,让我知道,如果你的作品?

Can you try it and let me know if it works for you?