• Blog
  • Info Support
  • Career
  • Training
  • International Group
  • Info Support
  • Blog
  • Career
  • Training
  • International Group
  • Search
logo InfoSupport
  • Latest blogs
  • Popular blogs
  • Experts
      • All
      • Bloggers
      • Speakers
  • Meet us
  • About us
    • nl
    • en
    • .NET
    • 3D printing
    • Advanced Analytics
    • Agile
    • Akka
    • Alexa
    • Algorithms
    • Api's
    • Architectuur
    • Artificial Intelligence
    • ATDD
    • Augmented Reality
    • AWS
    • Azure
    • Big Data
    • Blockchain
    • Business Intelligence
    • Chatbots
    • Cloud
    • Code Combat
    • Cognitive Services
    • Communicatie
    • Containers
    • Continuous Delivery
    • CQRS
    • Cyber Security
    • Dapr
    • Data
    • Data & Analystics
    • Data Science
    • Data Warehousing
    • Databricks
    • DataOps
    • Developers life
    • DevOps
    • Digital Days
    • Digital Twin
    • Docker
    • eHealth
    • Enterprise Architecture
    • Event Sourcing
    • Hacking
    • Infrastructure & Hosting
    • Innovatie
    • Integration
    • Internet of Things
    • Java
    • Machine Learning
    • Microservices
    • Microsoft
    • Microsoft Bot Framework
    • Microsoft Data Platform
    • Mobile Development
    • Mutation Testing
    • Open source
    • Pepper
    • Power BI
    • Privacy & Ethiek
    • Python
    • Quality Assistance & Test
    • Quality Assurance & Test
    • Requirements Management
    • Scala
    • Scratch
    • Security
    • SharePoint
    • Software Architecture
    • Software development
    • Software Factory
    • SQL Server
    • SSL
    • Start-up
    • Startup thinking
    • Stryker
    • Test Quality
    • Testing
    • TLS
    • TypeScript
    • Various
    • Web Development
    • Web-scale IT
    • Xamarin
    • All
    • Bloggers
    • Speakers
Home » Web Deployment projects in a Team Build.
  • Web Deployment projects in a Team Build.

    • By Martijn Beenes
    • .NET 17 years ago
    • .NET 0 comments
    • .NET .NET
    Web Deployment projects in a Team Build.

    Recently one of our customers decided to incorporate Team System into there development process. They wanted to migrate al there existing sources from there source repository system to Team Foundation Version Control.


    The sources mainly exist of ‘old’ asp code and some vb 6.0 code. There is some .NET 1.1 code as well but it will be migrated to .NET 2.0.


    I have been asked to help implement a Team Foundation Build to compile the .NET code and deploy the deliverables as well as the asp files.


     


    As described in this post, Team Build calls various targets. Some of those targets are already implemented by Microsoft. One of the default implemented targets is the CoreDropBuild target. This target is responsible for copying the output files to a deployment directory.


    The files being copied are the assemblies that are created in the build, the program database files and files that are marked in the projects as files to be copied to the output directory (property: Copy To Output Directory is set to true.)


    Al these files, for all the solutions in the build, are copied to a single directory. Unfortunately, this results in some unwanted behavior. Because all the files are copied to a single directory, files with the same filename are overwritten and only one copy of a file with a specific filename is available in this directory.


    Furthermore, because all the files are dropped into a single directory, directory structures needed for the application (especially websites) are no longer available.


    Fortunately Microsoft recently released a new project type, the Web Deployment project type that helped us a lot.


    This project is linked to a Web site project or a Web application project and ensures that the websites are correctly deployed using MsBuild.


     


    A small problem occurs however when those web deployment projects are used in a Team Build environment. Because the default Team Build implementation builds the output of all the projects in a build to a single build directory, the bin directory for each project is empty. The Web Deployment project however expects that the binaries for the web site/application projects are located in those bin directories.


    As the Visual Studio 2005 project files are actually MsBuild files, this problem is easily fixed. Just add some custom MsBuild code to the web site/application project files to copy the output files back.


     


    Here is an example of the MsBuild code I used, to copy the binaries back to the project bin folder.


     



    <Target Name=“AfterBuild“>



    <CreateItem Include=“$(OutDir)$(AssemblyName).*“>


           <Output ItemName=“FilesToCopy“ TaskParameter=“Include“ />


    CreateItem>


     



    <Copy SourceFiles=“@(FilesToCopy)“


          DestinationFiles=“@(FilesToCopy –> ‘$(MSBuildProjectDirectory)Bin%(Filename)%(Extension)’)“


          ContinueOnError=“true“


    />


     







    <ResolveAssemblyReference


          Assemblies=”$(AssemblyName)”            


          SearchPaths=”$(OutDir);{TargetFrameworkDirectory};{GAC}”


          TargetFrameworkDirectories=”$(TargetFrameworkDirectory)”


          FindDependencies=”true”


          FindSatellites=”true”


          FindSerializationAssemblies=”true”


          FindRelatedFiles=”true”>


        <Output TaskParameter=”CopyLocalFiles” ItemName=”RefToCopy” />


    ResolveAssemblyReference>


     



    <Copy SourceFiles=“@(RefToCopy)“


                 DestinationFiles=“@(RefToCopy -> ‘$(MSBuildProjectDirectory)Bin%(Filename)%(Extension)’)“


                 ContinueOnError=“true“


    />


    Target>


     


    The AfterBuild target is used to copy the project output (binaries) and the appropriate referenced assemblies back to the bin folder. This target is one of the targets that are provided by Microsoft to add customizations.


     


    Hopes this helps, 

    Share this

Martijn Beenes

View profile

Related IT training

Go to training website

Related Consultancy solutions

Go to infosupport.com

Related blogs

  • Configuring SQL Server encrypted connections using Powe…

    Configuring SQL Server encrypted connections using Powe… Léon Bouquiet - 1 month ago

  • Where to position SpecFlow in the Test Pyramid?

    Where to position SpecFlow in the Test Pyramid? Ronald Bosma - 4 months ago

  • Building a custom Kubernetes operator in C#

    Building a custom Kubernetes operator in C# Willem Meints - 8 months ago

Data Discovery Channel

  • Data+AI Summit 2023

  • Blijf je Azure cloud omgeving de baas met CloudXcellence

  • MLOps

Nieuwsbrief

* verplichte velden

Contact

  • Head office NL
  • Kruisboog 42
  • 3905 TG Veenendaal
  • T +31 318 552020
  • Call
  • Mail
  • Directions
  • Head office BE
  • Generaal De Wittelaan 17
  • bus 30 2800 Mechelen
  • T +32 15 286370
  • Call
  • Mail
  • Directions

Follow us

  • Twitter
  • Facebook
  • Linkedin
  • Youtube

Newsletter

Sign in

Extra

  • Media Library
  • Disclaimer
  • Algemene voorwaarden
  • ISHBS Webmail
  • Extranet
Beheer cookie toestemming
Deze website maakt gebruik van Functionele en Analytische cookies voor website optimalisatie en statistieken.
Functioneel Always active
De technische opslag of toegang is strikt noodzakelijk voor het legitieme doel het gebruik mogelijk te maken van een specifieke dienst waarom de abonnee of gebruiker uitdrukkelijk heeft gevraagd, of met als enig doel de uitvoering van de transmissie van een communicatie over een elektronisch communicatienetwerk.
Voorkeuren
De technische opslag of toegang is noodzakelijk voor het legitieme doel voorkeuren op te slaan die niet door de abonnee of gebruiker zijn aangevraagd.
Statistieken
De technische opslag of toegang die uitsluitend voor statistische doeleinden wordt gebruikt. De technische opslag of toegang die uitsluitend wordt gebruikt voor anonieme statistische doeleinden. Zonder dagvaarding, vrijwillige naleving door uw Internet Service Provider, of aanvullende gegevens van een derde partij, kan informatie die alleen voor dit doel wordt opgeslagen of opgehaald gewoonlijk niet worden gebruikt om je te identificeren.
Marketing
De technische opslag of toegang is nodig om gebruikersprofielen op te stellen voor het verzenden van reclame, of om de gebruiker op een website of over verschillende websites te volgen voor soortgelijke marketingdoeleinden.
Manage options Manage services Manage vendors Read more about these purposes
Voorkeuren
{title} {title} {title}