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> <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"> <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?
Sayed Ibrahim Hashimi
source share