Create clickonce web deployment package

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

Here would be an ideal process:

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

The idea that we can build a whole solution, including web packages, run all the tests, and then deploy only after passing the tests.

I am currently looking at file-based deployments in a temporary folder, copy it into a web project, and then pack the web project. Is there a tidier solution?

+7
source share
1 answer

I created a blog for this at http://sedodream.com/2012/02/18/HowToCreateAWebDeployPackageWhenPublishingAClickOnceProject.aspx , which contains more detailed information but the relevant snippets below

If you have a client project from which you want to create the ClickOnce package, you can try the following.

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

  <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:

  • Web Deployment Package Name Declaration
  • trying to see where MSDeploy is installed.

After that, CreateWebDeployPackage is defined, which will be executed after the PublishOnly target (due to AfterTargets = "PublishOnly"). This target will make a call to msdeploy.exe to create the package in the output directory. You must accept this package and publish it like any other package.

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

+9
source

All Articles