2

I have a Visual Studio solution with multiple webapp projects. The build should create a web package for each project. The web packages should finally end up in a folder structor like this:

$(Outputfolder)
|
+-- Web
    |
    +-- <name package 1>
    |   |
    |   +-- ... package files ...
    |
    +-- <name package 2>
    |   |
    |   +-- ... package files ...
    |
    +-- ...
    |

In order to change the destination folder for a web package I have added a .wpp.targets file to each web app project. Here I have adjusted the DefaultPackageOutputDir property:

<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <DefaultPackageOutputDir Condition=" '$(DefaultPackageOutputDir)'=='' ">$(OutFolder)Web\Webapp1\</DefaultPackageOutputDir>
  </PropertyGroup>

</Project>

This is it how I call MSBuild. I simply hand over the output folder as a property:

<MSBuild Projects="@(ItemToBuild)"
         Targets="Build"
         Properties="Configuration=$(Configuration);
                     Platform=$(Platform);
                     DeployOnBuild=True;
                     DeployTarget=Package;
                     OutFolder=$(OutFolder)" />

This does the trick but I'm not completely satisfied. I want to make the build more general. It bothers me, that I have to name the webapp explicitly. My idea was to use the property DefaultMSDeployDestinationApplicationName instead:

<?xml version="1.0" encoding="utf-8" ?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <DefaultPackageOutputDir Condition=" '$(DefaultPackageOutputDir)'=='' ">$(OutFolder)Web\$(DefaultMSDeployDestinationApplicationName)\</DefaultPackageOutputDir>
  </PropertyGroup>

</Project>

Unfortunately the property DefaultMSDeployDestinationApplicationName seems to be empty. The package files end up in the Web folder. I guess the property DefaultMSDeployDestinationApplicationName is not yet defined at the time the .wpp.targets file is readed.

Does somebody know a better place to define the property DefaultPackageOutputDir?

3
  • Did you ever solve this? Commented Sep 13, 2016 at 20:41
  • No, I was not able to solve this. At last I have switched to FAKE. Commented Sep 13, 2016 at 21:26
  • I got it-- see below. Commented Sep 16, 2016 at 13:44

1 Answer 1

1

I was able to change the output directory for a Web Project by specifying the following options to MsBuild:

/p:OutDir="$(build.artifactstagingdirectory)\$(BuildConfiguration)" /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true
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.