Saturday, April 13, 2013

Web Deployment in TFS2012 - Part 2

In the previouse post i have shown how to publish.
this we publish the whole site, but what if i need external resources or exclude some config files?
so i looked around good people and here is what i found (also validated):

Adding to the Deployment
 <PropertyGroup>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
  </PropertyGroup>
 
  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="D:\Dev\W2012TFS2012Prd\DefaultCollection\Test\MySites\MvcApplication\Properties\PublishProfiles\**\*" />
 
      <FilesForPackagingFromProject  Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>Extra Files\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>


Exclude From Deployment
<PropertyGroup>
    <ExcludeFilesFromPackageDependsOn>
        $(ExcludeFilesFromPackageDependsOn);
        _ExcludeAzureDlls
    </ExcludeFilesFromPackageDependsOn>
</PropertyGroup>

<Target Name="_ExcludeAzureDlls">
    <ItemGroup>
        <AzureFiles Include="@(FilesForPackagingFromProject)"
                    Exclude="@(FilesForPackagingFromProjectWithNoAzure)" />
        <ExcludeFromPackageFiles Include="@(AzureFiles)">
            <FromTarget>_ExcludeAzureEnvironmentDlls</FromTarget>
        </ExcludeFromPackageFiles>
    </ItemGroup>
</Target>

 
here is a MSDN FAQ about Web Deployment http://msdn.microsoft.com/en-us/library/ee942158.aspx it also helped abit

No comments:

Post a Comment