创建 clickonce webdeploy 包

发布于 2025-01-05 23:35:12 字数 381 浏览 0 评论 0原文

是否可以构建一个包含可使用标准 webdeploy 工具部署到 Web 服务器的 clickonce 应用程序的 Web 部署包?

这是理想的过程:

  1. MSBuild "YourFullyQualifiedProjectName.csproj/vbproj" /T:Package
  2. obj\Debug\Package\YourFullyQualifiedProjectName.deploy.cmd /Y

这背后的原因是这样我们可以构建包括 Web 包在内的整个解决方案,运行所有测试,然后仅在测试通过后进行部署。

我目前正在考虑对临时文件夹进行基于文件的部署,将其复制到 Web 项目中,然后打包该 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?

Here would be the ideal process:

  1. MSBuild "YourFullyQualifiedProjectName.csproj/vbproj" /T:Package
  2. obj\Debug\Package\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.

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北笙凉宸 2025-01-12 23:35:13

我为此创建了一个博客 http://sedodream.com/2012/02/18 /HowToCreateAWebDeployPackageWhenPublishingAClickOnceProject.aspx 其中包含更多详细信息,但相关部分如下

如果您有一个要从中创建 ClickOnce 包的客户端项目,那么您可以尝试以下操作。

编辑您的客户端项目的项目文件,并在底部添加以下内容( 标记的正上方)。

  <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 中,我是:

  • 声明 Web 部署包的名称,
  • 尝试查看 MSDeploy 的安装位置

之后定义 CreateWebDeployPackage,它将在 PublishOnly 目标之后执行(因为 AfterTargets="PublishOnly" )。该目标将调用 msdeploy.exe 以在输出目录中创建包。您应该能够像发布任何其他包一样获取该包并发布它。

您可以尝试一下并告诉我它是否适合您吗?

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

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

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>

In the PropertyGroup I am:

  • declaring the name of the web deploy package
  • trying to see where MSDeploy is installed

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文