0

I have a solution with A LOT of web projects (80+). I'm using WDP to deploy my projects to the environments, so I have a script that builds a web deploy package for each project and then each package is published.

Each package is deployed without deleting what is already there and each package can override duplicate files. It works but the deployment is quite slow.

I have a strong suspicion that having one package with all the file would be a lot faster, since from the looks of it a lot of the time is spent on the setup of the connection to the server and not much on the deployment itself (probably because many files are not updated)

Is there a way to build a single WDP from multiple web projects in visual studio solution or using MSBuild and a couple of scripts?

Thanks

1 Answer 1

1

Is there a way to build a single WDP from multiple web projects in visual studio solution or using MSBuild and a couple of scripts?

Since you have a script that builds a web deploy package for each project, you can try to deploy those project to the local folder, you can think of this an “intermediate publish folder”. From there you can construct a zip task to all packages to one zip file, then publish/copy this zip file to publish directly.

To accomplish this, you can create a .csproj file with following code:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <OutputType>Library</OutputType>
  </PropertyGroup>

  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

  <Target Name="Zip" AfterTargets="Build">
    <CreateItem Include="YourLocalPublishFolder\*.*" >
            <Output ItemName="ZipFiles" TaskParameter="Include"/>
    </CreateItem>
    <Zip ZipFileName="YourZipFile.zip" WorkingDirectory="YourPublishFolder" Files="@(ZipFiles)" />

With this .csproj file, all .zip are compressed into a package to the publish folder, do not need to publish each project to the publish folder.

Note: Need import the MSBuildTasks.targets to the .csproj file, which including Zip target.

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.