New way of transforming web.config file that should work in both VS2010 and 2012

Moved transform responsibility to Umbraco.Web.UI (mainly because circular
dependency has been solved already a few months ago)
Managed to clean up build.proj significantly in the process
This commit is contained in:
Sebastiaan Janssen
2012-12-03 15:53:06 -01:00
parent b02ad9e698
commit 97639040f0
5 changed files with 41 additions and 505 deletions

View File

@@ -64,4 +64,5 @@ src/Umbraco.Tests/config/umbracoSettings.config
src/Umbraco.Web.UI/App_Plugins/*
src/Umbraco.Web.UI/Views/*
src\Umbraco.Web.UI\[W]eb.config
src\Umbraco.Web.UI\[W]eb.config
*.transformed

View File

@@ -1,4 +1,4 @@
<Project InitialTargets="Build" DefaultTargets="AfterBuild" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
****************************************************
@@ -46,8 +46,8 @@
</PropertyGroup>
<ItemGroup>
<SystemFolders Include="$(WebAppFolder)App_Plugins" />
<SystemFolders Include="$(WebAppFolder)App_Code" />
<SystemFolders Include="$(WebAppFolder)App_Plugins" />
<SystemFolders Include="$(WebAppFolder)App_Code" />
<SystemFolders Include="$(WebAppFolder)App_Data" />
<SystemFolders Include="$(WebAppFolder)media" />
<SystemFolders Include="$(WebAppFolder)masterpages" />
@@ -56,6 +56,7 @@
<SystemFolders Include="$(WebAppFolder)macroScripts" />
<SystemFolders Include="$(WebAppFolder)xslt" />
<SystemFolders Include="$(WebAppFolder)usercontrols" />
<SystemFolders Include="$(WebAppFolder)Views" />
</ItemGroup>
<!--
@@ -75,7 +76,6 @@
</Target>
<Target Name="ZipWebPiApp" DependsOnTargets="ZipWebApp" >
<!-- Clean folders -->
<RemoveDir Directories="$(WebPiFolder)" />
<MakeDir Directories="$(WebPiFolder)" />
@@ -84,13 +84,6 @@
<!-- Copy fresh built umbraco files -->
<Exec Command="xcopy %22$(WebAppFolderAbsolutePath)*%22 %22$(WebPiFolderAbsolutePath)umbraco%22 /S /E /Y /I" />
<!--<ItemGroup>
<WebAppFiles Include="$(WebAppFolder)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(WebAppFiles)"
DestinationFiles="@(WebAppFiles->'$(WebPiFolder)umbraco\%(RecursiveDir)%(Filename)%(Extension)')" />-->
<!-- Copy Web Pi template files -->
<ItemGroup>
<WebPiFiles Include="..\src\WebPi\**\*.*" />
@@ -101,11 +94,9 @@
<!-- Zip the files -->
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameWebPi)%22 %22$(WebPiFolderAbsolutePath)*%22" />
</Target>
<Target Name="ZipWebApp" DependsOnTargets="CreateSystemFolders" >
<Message Text="Starting to zip to $(buildDate)-$(BuildZipFileName)" Importance="high" />
<Exec Command="..\tools\7zip\7za.exe a -r %22$(BuildZipFileNameBin)%22 %22$(SolutionBinFolderAbsolutePath)*%22" />
@@ -119,7 +110,6 @@
</Target>
<Target Name="CopyLibraries" DependsOnTargets="OffsetTimestamps" >
<!-- Copy SQL CE -->
<ItemGroup>
<SQLCE4Files Include="..\src\packages\SqlServerCE.4.0.0.0\**\*.*" />
@@ -143,7 +133,7 @@
</Target>
<!-- Offset the modified timestamps on all umbraco dlls, as WebResources break if date is in the future, which, due to timezone offsets can happen. -->
<Target Name="OffsetTimestamps" DependsOnTargets="CompileProjects">
<Target Name="OffsetTimestamps" DependsOnTargets="CopyTransformedWebConfig">
<CreateItem Include="$(BuildFolder)**\umbraco.*.dll">
<Output TaskParameter="Include" ItemName="FilesToOffsetTimestamp" />
</CreateItem>
@@ -152,80 +142,26 @@
<Message Text="Finished offsetting timestamps" Importance="high" />
</Target>
<!-- Copy the transformed web.config file to the root -->
<Target Name="CopyTransformedWebConfig" DependsOnTargets="CompileProjects">
<ItemGroup>
<WebConfigFile Include="..\src\Umbraco.Web.UI\web.$(BuildConfiguration).Config.transformed" />
</ItemGroup>
<Copy SourceFiles="@(WebConfigFile)"
DestinationFiles="$(WebAppFolder)Web.config"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false" />
</Target>
<Target Name="CompileProjects">
<Message Text="Compiling web project to build\$(BuildFolder)" Importance="high" />
<!-- For UseWPP_CopyWebApplication=True see http://stackoverflow.com/questions/1983575/copywebapplication-with-web-config-transformations -->
<MSBuild Projects="..\src\Umbraco.Web.UI\Umbraco.Web.UI.csproj" Properties="WarningLevel=0;Configuration=$(BuildConfiguration);UseWPP_CopyWebApplication=True;PipelineDependsOnBuild=False;OutDir=$(SolutionBinFolderAbsolutePath);WebProjectOutputDir=$(WebAppFolderAbsolutePath)" Targets="Clean;Build;" BuildInParallel="False" ToolsVersion="4.0" UnloadProjectsOnCompletion="False">
</MSBuild>
<!--
Now, because of all the circular dependencies we need to build those projects and have them dump their DLLs/assets out to the same folder. Really wish this wasn't the case!
These are: umbraco.editorControls umbraco.webservices umbraco.MacroEngines
Each of these projects has a post build to put their stuff in the correct location based on the solution and unfortunately for us each
of these projects references the web application! So if we specify an OutDir parameter it will also trigger a web deploy and chuck another
website output in bin/_PublishedWebSites folder. we cannot disable this: http://social.msdn.microsoft.com/forums/en-US/tfsbuild/thread/3ec642ad-2e6d-424c-891a-62f6409da62a/
so we need to just build the project 'in-place' then copy its output to the SolutionBinFolder
-->
<!-- MACRO ENGINES -->
<Message Text="Compiling MacroEngines project" Importance="high" />
<MSBuild Projects="..\src\umbraco.MacroEngines\umbraco.MacroEngines.csproj" Properties="WarningLevel=0;Configuration=$(BuildConfiguration);" Targets="Clean;Build;" BuildInParallel="False" ToolsVersion="4.0" UnloadProjectsOnCompletion="False">
</MSBuild>
<ItemGroup>
<MacroEngineDll Include="..\src\umbraco.MacroEngines\bin\$(BuildConfiguration)\umbraco.MacroEngines.dll"/>
</ItemGroup>
<Copy SourceFiles="@(MacroEngineDll)"
DestinationFolder="$(SolutionBinFolder)" OverwriteReadOnlyFiles="True"/>
<Copy SourceFiles="@(MacroEngineDll)"
DestinationFolder="$(WebAppFolder)\bin" OverwriteReadOnlyFiles="True"/>
<!-- EDITOR CONTROLS -->
<Message Text="Compiling editorControls project" Importance="high" />
<MSBuild Projects="..\src\umbraco.editorControls\umbraco.editorControls.csproj" Properties="WarningLevel=0;Configuration=$(BuildConfiguration);" Targets="Clean;Build;" BuildInParallel="False" ToolsVersion="4.0" UnloadProjectsOnCompletion="False">
</MSBuild>
<ItemGroup>
<EditorControlsDll Include="..\src\umbraco.editorControls\bin\$(BuildConfiguration)\umbraco.editorControls.dll"/>
</ItemGroup>
<Copy SourceFiles="@(EditorControlsDll)"
DestinationFolder="$(SolutionBinFolder)" OverwriteReadOnlyFiles="True"/>
<Copy SourceFiles="@(EditorControlsDll)"
DestinationFolder="$(WebAppFolder)\bin" OverwriteReadOnlyFiles="True"/>
<!-- WEBSERVICES -->
<Message Text="Compiling webservices project" Importance="high" />
<MSBuild Projects="..\src\umbraco.webservices\umbraco.webservices.csproj" Properties="WarningLevel=0;Configuration=$(BuildConfiguration);" Targets="Clean;Build;" BuildInParallel="False" ToolsVersion="4.0" UnloadProjectsOnCompletion="False">
</MSBuild>
<ItemGroup>
<WebServicesDll Include="..\src\umbraco.webservices\bin\$(BuildConfiguration)\umbraco.webservices.dll"/>
<WebServicesASMX Include="..\src\umbraco.webservices\*.asmx"/>
</ItemGroup>
<Copy SourceFiles="@(WebServicesDll)"
DestinationFolder="$(SolutionBinFolder)" OverwriteReadOnlyFiles="True"/>
<Copy SourceFiles="@(WebServicesDll)"
DestinationFolder="$(WebAppFolder)\bin" OverwriteReadOnlyFiles="True"/>
<Copy SourceFiles="@(WebServicesASMX)"
DestinationFolder="$(WebAppFolder)\umbraco\webservices\api" OverwriteReadOnlyFiles="True"/>
<!-- SQLCE4UMBRACO -->
<!--<Message Text="Compiling SQLCE4Umbraco project" Importance="high" />
<MSBuild Projects="..\src\SQLCE4Umbraco\SQLCE4Umbraco.csproj" Properties="WarningLevel=0;Configuration=$(BuildConfiguration);" Targets="Clean;Build;" BuildInParallel="False" ToolsVersion="4.0" UnloadProjectsOnCompletion="False">
</MSBuild>
<ItemGroup>
<SQLCE4UmbracoDll Include="..\src\SQLCE4Umbraco\bin\$(BuildConfiguration)\SQLCE4Umbraco.dll" />
</ItemGroup>
<Copy SourceFiles="@(SQLCE4UmbracoDll)"
DestinationFolder="$(SolutionBinFolder)" OverwriteReadOnlyFiles="True"/>
<Copy SourceFiles="@(SQLCE4UmbracoDll)"
DestinationFolder="$(WebAppFolder)\bin" OverwriteReadOnlyFiles="True"/>-->
<!-- DONE -->
<Message Text="Finished compiling projects" Importance="high" />
</Target>
<Target Name="AfterBuild">
<Message Text="Hi" />
</Target>
</Project>

View File

@@ -2245,7 +2245,28 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
<Import Project="$(MSBuildStartupDirectory)\..\src\umbraco.presentation.targets" Condition="$(BuildingInsideVisualStudio) != true" />
<Import Project="$(SolutionDir)umbraco.presentation.targets" Condition="$(BuildingInsideVisualStudio) == true" />
<PropertyGroup>
<!--<PostBuildEvent>xcopy "$(ProjectDir)..\..\lib\*.dll" "$(TargetDir)*.dll" /Y</PostBuildEvent>-->
<PostBuildEvent></PostBuildEvent>
</PropertyGroup>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<Target Name="BeforeBuild">
<Copy
SourceFiles="$(ProjectDir)web.Template.config"
DestinationFiles="$(ProjectDir)Web.config"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false"
Condition="!Exists('$(ProjectDir)Web.config')"
/>
<TransformXml Source="$(ProjectDir)Web.config" Transform="$(ProjectDir)web.Template.$(Configuration).config" Destination="$(ProjectDir)Web.$(Configuration).config.transformed" />
<Message Text="BeforeBuild was performed" Importance="high" />
</Target>
<Target Name="AfterBuild">
<Copy
SourceFiles="$(ProjectDir)Web.$(Configuration).config.transformed"
DestinationFiles="$(ProjectDir)Web.config"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false"
Condition="$(BuildingInsideVisualStudio) == true"
/>
</Target>
</Project>

View File

@@ -57,39 +57,6 @@
*****************************************************
-->
<!-- Make sure web.config will be there even for package/publish -->
<Target Name="CopyWebConfig" BeforeTargets="Build;Rebuild">
<PropertyGroup>
<OriginalFileName>$(ProjDir)Web.Template.config</OriginalFileName>
<OutputFileName>$(ProjOutputDir)Web.config</OutputFileName>
</PropertyGroup>
<Copy
SourceFiles="$(OriginalFileName)"
DestinationFiles="$(OutputFileName)"
OverwriteReadOnlyFiles="true"
SkipUnchangedFiles="false"
Condition="!Exists('$(OutputFileName)')"
/>
</Target>
<Target Name="CustomTarget" AfterTargets="CopyWebConfig">
<Message Text="Building in VS? $(BuildingInsideVisualStudio)" Importance="high" />
<Message Text="Transforming: $(WebConfigSource), running MSBuild on project $(MSBuildProjectDirectory)" Importance="high" />
<PropertyGroup>
<OriginalFileName>$(ProjDir)Web.Template.config</OriginalFileName>
<OutputFileName>$(ProjOutputDir)Web.config</OutputFileName>
</PropertyGroup>
<Message Text="$(OriginalFileName)" Importance="high" />
<Message Text="$(OutputFileName)" Importance="high" />
<TransformXml Condition="$(BuildingInsideVisualStudio) == ''" Source="$(OriginalFileName)" Transform="$(WebConfigSource)" Destination="$(OutputFileName)" />
<TransformXml Condition="$(BuildingInsideVisualStudio) == 'true'" Source="$(OriginalFileName)" Transform="$(WebConfigSource)" Destination="$(OutputFileName)" />
</Target>
<Target Name="ResetConfigFiles" Condition="$(ProjDir) != $(ProjOutputDir)" BeforeTargets="Build;Rebuild" Inputs="@(ConfigFiles)" Outputs="%(Identity).Dummy">
<PropertyGroup>

View File

@@ -1,389 +0,0 @@
<!--
***********************************************************************************************
Microsoft.WebApplication.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your web deploy projects from the command-line or the IDE.
This file defines the steps in the standard build process for web application projects.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Microsoft.WebApplication.Build.Tasks.GetSilverlightItemsFromProperty" AssemblyFile="Microsoft.WebApplication.Build.Tasks.dll" />
<UsingTask TaskName="Microsoft.WebApplication.Build.Tasks.CopyFilesToFolders" AssemblyFile="Microsoft.WebApplication.Build.Tasks.dll" />
<PropertyGroup>
<IsDesktopBuild Condition="'$(IsDesktopBuild)'=='' And '$(TeamFoundationServerUrl)' != ''">False</IsDesktopBuild>
<WebProjectOutputDirInsideProjectDefault>True</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProjectDefault Condition="('$(OutDir)' != '$(OutputPath)') Or ('$(IsDesktopBuild)' == 'False')" >False</WebProjectOutputDirInsideProjectDefault>
<WebProjectOutputDirInsideProject Condition="'$(WebProjectOutputDirInsideProject)' == ''">$(WebProjectOutputDirInsideProjectDefault)</WebProjectOutputDirInsideProject>
<DisableLinkInCopyWebApplicaton Condition="'$(DisableLinkInCopyWebApplicaton)'==''">False</DisableLinkInCopyWebApplicaton>
<Disable_CopyWebApplication Condition="'$(Disable_CopyWebApplication)' == ''">False</Disable_CopyWebApplication>
<UseWPP_CopyWebApplication Condition="'$(UseWPP_CopyWebApplication)' == ''">False</UseWPP_CopyWebApplication>
<CleanWebProjectOutputDir>True</CleanWebProjectOutputDir>
<CleanWebProjectOutputDir Condition="$(WebProjectOutputDirInsideProject)" >False</CleanWebProjectOutputDir>
</PropertyGroup>
<!--Only setup $(WebProjectOutputDir) iff user haven't set it up-->
<PropertyGroup Condition="'$(WebProjectOutputDir)'==''">
<WebProjectOutputDir>$(MSBuildProjectDirectory)</WebProjectOutputDir>
<WebProjectOutputDir Condition="!$(WebProjectOutputDirInsideProject)">$(OutDir)_PublishedWebsites\$(MSBuildProjectName)</WebProjectOutputDir>
</PropertyGroup>
<PropertyGroup>
<PrepareForRunDependsOn>
$(PrepareForRunDependsOn);
CopySilverlightApplications;
_CopyBinDeployableAssemblies;
</PrepareForRunDependsOn>
<PrepareForRunDependsOn Condition="!$(Disable_CopyWebApplication)">
$(PrepareForRunDependsOn);
_CopyWebApplication;
_BuiltWebOutputGroupOutput
</PrepareForRunDependsOn>
</PropertyGroup>
<!--***************************************************************-->
<!--Global setting for Clean target -->
<!--***************************************************************-->
<PropertyGroup>
<CleanDependsOn>
$(CleanDependsOn);
CleanWebProjectOutputDir;
</CleanDependsOn>
</PropertyGroup>
<!--********************************************************************-->
<!-- CleanWebProjectOutputDir -->
<!-- ********************************************************************-->
<PropertyGroup>
<CleanWebProjectOutputDirDependsOn Condition="'$(CleanWebProjectOutputDirDependsOn)' == ''">
</CleanWebProjectOutputDirDependsOn>
</PropertyGroup>
<Target Name="CleanWebProjectOutputDir"
Condition="$(CleanWebProjectOutputDir)"
DependsOnTargets="$(CleanWebProjectOutputDirDependsOn)">
<!--Assertion check-->
<!--In the case of Clean Packaging/Publish, we simply delete the WebProjectOutputDir-->
<RemoveDir Condition="Exists($(WebProjectOutputDir))" Directories="$(WebProjectOutputDir)" ContinueOnError="true" />
</Target>
<!--
============================================================
_CopyWebApplication
This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.
This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.
The original _CopyWebApplication is now a Legacy, you can still use it by setting $(UseWPP_CopyWebApplication) to true.
By default, it now change to use _WPPCopyWebApplication target in Microsoft.Web.Publish.targets. It allow to leverage the web.config trsnaformation.
============================================================
-->
<PropertyGroup>
<!--This will be overwrite by ..\web\Microsoft.Web.Publishing.targets when $(UseWPP_CopyWebApplication) set to true-->
<OnBefore_CopyWebApplicationDefault>
_CopyWebApplicationLegacy;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplicationDefault Condition="$(UseWPP_CopyWebApplication) AND Exists('$(MSBuildThisFileDirectory)\..\Web\Microsoft.Web.Publishing.targets')">
_WPPCopyWebApplication;
</OnBefore_CopyWebApplicationDefault>
<OnBefore_CopyWebApplication Condition="'$(OnBefore_CopyWebApplication)'==''">
$(OnBefore_CopyWebApplicationDefault);
</OnBefore_CopyWebApplication>
<OnAfter_CopyWebApplication Condition="'$(OnAfter_CopyWebApplication)'==''">
</OnAfter_CopyWebApplication>
<_CopyWebApplicationDependsOn Condition="'$(_CopyWebApplicationDependsOn)'==''">
$(OnBefore_CopyWebApplication);
</_CopyWebApplicationDependsOn>
</PropertyGroup>
<Target Name="_CopyWebApplication"
Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'"
DependsOnTargets="$(_CopyWebApplicationDependsOn)">
<CallTarget Condition="'$(OnAfter_CopyWebApplication)' != ''" Targets="$(OnAfter_CopyWebApplication)" RunEachTargetSeparately="true" />
</Target>
<!--
============================================================
_CopyWebApplicationLegacy
This target will copy the build outputs along with the
content files into a _PublishedWebsites folder.
This Task is only necessary when $(OutDir) has been redirected
to a folder other than ~\bin such as is the case with Team Build.
============================================================
-->
<Target Name="_CopyWebApplicationLegacy" Condition="!$(Disable_CopyWebApplication) And '$(OutDir)' != '$(OutputPath)'" >
<!-- Log tasks -->
<Message Text="Copying Web Application Project Files for $(MSBuildProjectName)" />
<!-- Create the _PublishedWebsites\app\bin folder -->
<MakeDir Directories="$(WebProjectOutputDir)\bin" />
<!-- Copy build outputs to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(AddModules)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)"
DestinationFolder="$(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)"
SkipUnchangedFiles="true"
Condition="'$(_SGenDllCreated)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).pdb"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DebugSymbolsProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(DocFileItem)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Condition="'$(_DocumentationFileProduced)'=='true'"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)"
DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(ReferenceCopyLocalPaths)"
DestinationFiles="@(ReferenceCopyLocalPaths->'$(WebProjectOutputDir)\bin\%(DestinationSubDirectory)%(Filename)%(Extension)')"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy content files recursively to _PublishedWebsites\app\ folder -->
<Copy SourceFiles="@(Content)" Condition="'%(Content.Link)' == ''"
DestinationFolder="$(WebProjectOutputDir)\%(Content.RelativeDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
<Copy SourceFiles="@(Content)" Condition="!$(DisableLinkInCopyWebApplicaton) And '%(Content.Link)' != ''"
DestinationFiles="$(WebProjectOutputDir)\%(Content.Link)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy items that have been marked to be copied to the bin folder -->
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectory)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectoryAlways)"
DestinationFolder="$(WebProjectOutputDir)\bin"
SkipUnchangedFiles="false"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy Silverlight Zip and Xzp file to _PublishedWebsites\app\ folder-->
<Copy SourceFiles="@(_WebApplicationSilverlightXapFiles)"
DestinationFolder="$(WebProjectOutputDir)\%(_WebApplicationSilverlightXapFiles.RelativeDir)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!-- Copy items that need to be bin deployed to the bin folder -->
<Copy SourceFiles="@(_binDeployableAssemblies)"
DestinationFolder="$(WebProjectOutputDir)\bin\%(_binDeployableAssemblies.DestinationRelPath)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
</Target>
<!--
============================================================
_BuiltWebOutputGroupOutput
This target creates and populates BuiltWebOutputGroupOutput
with contents of bin along with the @(Content) files
============================================================
-->
<Target Name ="_BuiltWebOutputGroupOutput"
Condition="!$(Disable_CopyWebApplication)"
Outputs="@(BuiltWebOutputGroupOutput)">
<CreateItem Include="$(WebProjectOutputDir)\bin\**\*.*;@(Content->'%(FullPath)')" Condition="'$(OutDir)' == '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>
<CreateItem Include="$(WebProjectOutputDir)\**\*.*" Condition="'$(OutDir)' != '$(OutputPath)'">
<Output ItemName="BuiltWebOutputGroupOutput" TaskParameter="Include"/>
</CreateItem>
</Target>
<!--
============================================================
_GetSilverlightApplications
Converts the list of Silverlight Applications that are defined
in the property $(SilverlightApplicationList) to ITaskItems that
can be used by teh CopySilverlightApplication task
The format of $(SilverlightApplicationList) is:
{projGuid}|relPath|tgtFolder;{projGuid2}|relPathToProject2|tgtFolder2;...
============================================================
-->
<Target
Name="_GetSilverlightApplications"
Condition="'$(SilverlightApplicationList)' != ''">
<GetSilverlightItemsFromProperty
SilverlightReferences="$(SilverlightApplicationList)"
ProjectPath="$(MSBuildProjectFullPath)">
<Output TaskParameter="SilverlightApplications" ItemName="_AllSilverlightApplications"/>
</GetSilverlightItemsFromProperty>
<!-- Break the silverlight application list into two lists: those that exist on disk and those that don't. -->
<ItemGroup>
<_SilverlightApplications Include="@(_AllSilverlightApplications)" Condition="Exists('%(Identity)')"/>
<_SilverlightApplicationsNotExist Include="@(_AllSilverlightApplications)" Condition="!Exists('%(Identity)')"/>
</ItemGroup>
</Target>
<!--
============================================================
CopySilverlightApplications
This target copies the output xap files from referenced
Silverlight application projects to the target folder.
============================================================
-->
<Target
Name="CopySilverlightApplications"
DependsOnTargets="_GetSilverlightApplications"
Outputs="@(_WebApplicationSilverlightXapFiles)"
Condition="'$(BuildingInsideVisualStudio)' != 'true'">
<!--
When building this project from the IDE or when building a .SLN from the command-line,
just gather the referenced build outputs (Xap files). The code that builds the .SLN will already have
built the project, so there's no need to do it again here. Since Silverlight only supports AnyCPU that is
what we use for the platform
The ContinueOnError setting is here so that, during project load, as
much information as possible will be passed to the compilers.
-->
<MSBuild
Projects="@(_SilverlightApplications)"
Targets="GetXapOutputFile"
BuildInParallel= "false"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);Platform=AnyCPU;BuildingSolutionFile=false"
Condition="'@(_SilverlightApplications)' != ''"
ContinueOnError="!$(BuildingProject)">
<Output TaskParameter="TargetOutputs" ItemName="_SilverlightXapFiles"/>
</MSBuild>
<!--
Build referenced projects when building from the command line.
The $(ProjectReferenceBuildTargets) will normally be blank so that the project's default
target is used during a P2P reference. However if a custom build process requires that
the referenced project has a different target to build it can be specified.
-->
<MSBuild
Projects="@(_SilverlightApplications)"
Targets="$(ProjectReferenceBuildTargets)"
Properties="%(_MSBuildProjectReferenceExistent.SetConfiguration);Platform=AnyCPU;BuildingSolutionFile=false"
BuildInParallel="false"
Condition="'$(BuildingInsideVisualStudio)' != 'true' and '@(_SilverlightApplications)' != ''">
</MSBuild>
<!--Copy the outputs to the target folder-->
<CopyFilesToFolders SourceFiles="@(_SilverlightXapFiles)"
SilverlightApplications="@(_SilverlightApplications)"
ConfigName="$(Configuration)"
Condition="'@(_SilverlightXapFiles)' != ''">
<Output TaskParameter="DestinationFiles" ItemName="_WebApplicationSilverlightXapFiles" />
</CopyFilesToFolders>
<!-- Issue a warning for each non-existent project. -->
<Warning
Text="The referenced Silverlight project '%(_SilverlightApplicationsNotExist.Identity)' does not exist."
Condition="'@(_SilverlightApplicationsNotExist)'!=''"/>
</Target>
<!--
============================================================
_CopyBinDeployableAssemblies
This target copies the contents of ProjectDir\_bin_deployableAssemblies to the bin
folder, preserving the relative paths
============================================================
-->
<Target
Name="_CopyBinDeployableAssemblies"
Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
<PropertyGroup>
<BinDeployableFolder Condition="'$(BinDeployableFolder)' == ''">_bin_deployableAssemblies\</BinDeployableFolder>
<BinDeployableFolderFullPath>$([System.IO.Path]::GetFullPath($(BinDeployableFolder)))</BinDeployableFolderFullPath>
</PropertyGroup>
<!--Pick up the deployable items from the $(None) collection that are under the _bin_deployableAssemblies folder -->
<CreateItem Include="@(None->'%(Identity)')" Condition="'%(None.FullPath)' != '' And $([System.String]::new('%(None.FullPath)').StartsWith($(BinDeployableFolderFullPath), StringComparison.OrdinalIgnoreCase ))" >
<Output ItemName="__binDeployableAssemblies" TaskParameter="Include"/>
</CreateItem>
<!--Add metadata which holds the destination relative folder to copy them to-->
<ItemGroup>
<_binDeployableAssemblies Include ="@(__binDeployableAssemblies)" Condition="'@(__binDeployableAssemblies)' != ''">
<DestinationRelPath>$([System.String]::Concat($([System.IO.Path]::GetDirectoryName($([System.String]::new('%(__binDeployableAssemblies.FullPath)')))),'\').SubString($(BinDeployableFolderFullPath.Length)))</DestinationRelPath>
</_binDeployableAssemblies>
</ItemGroup>
<!-- Do the copy-->
<Copy SourceFiles="@(_binDeployableAssemblies)" DestinationFolder="$(OutDir)%(_binDeployableAssemblies.DestinationRelPath)"
SkipUnchangedFiles="true"
Retries="$(CopyRetryCount)"
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"/>
<!--Add the items just copied to the collection of items to delete when doing a clean-->
<ItemGroup>
<FileWrites Include ="@(_binDeployableAssemblies->'$(OutDir)%(DestinationRelPath)%(Filename)%(Extension)')" />
</ItemGroup>
</Target>
<!--Import publishing target-->
<Import Project="..\Web\Microsoft.Web.Publishing.targets" Condition="Exists('..\Web\Microsoft.Web.Publishing.targets')" />
<!--Ensure the Siliverlight zap file is created and copied to the bin folder for the Microsoft.Web.Publishing.targets-->
<PropertyGroup>
<OnBeforePipelineCollectFilesPhase>
$(OnBeforePipelineCollectFilesPhase);
CopySilverlightApplications;
</OnBeforePipelineCollectFilesPhase>
</PropertyGroup>
</Project>