<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
	<PropertyGroup>
		<WebApplicationOutputDir Condition="'$(OutDir)' != '$(OutputPath)'">$(OutDir)_PublishedWebsites\$(MSBuildProjectName)</WebApplicationOutputDir>

		<PrepareForRunDependsOn>
			$(PrepareForRunDependsOn);
			_CopyWebApplication
		</PrepareForRunDependsOn>
	</PropertyGroup>

	<!-- OutDir has been overridden, so copy all the relevant files to that -->
	<Target Name="_CopyWebApplication" Condition="'$(OutDir)' != '$(OutputPath)'">
		<MakeDir Directories="$(WebApplicationOutputDir)\bin"/>
		<Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(WebApplicationOutputDir)\bin" SkipUnchangedFiles="true"/>
		<Copy
			SourceFiles="$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb"
			Condition="Exists('$(IntermediateOutputPath)$(AssemblyName)$(TargetExt).mdb')"
			DestinationFolder="$(WebApplicationOutputDir)\bin"
			SkipUnchangedFiles="true" />

		<Copy
			SourceFiles = "@(IntermediateSatelliteAssemblies)"
			DestinationFiles = "@(IntermediateSatelliteAssemblies->'$(WebApplicationOutputDir)\bin\%(Culture)\$(AssemblyName).resources.dll')"
			Condition = "'@(IntermediateSatelliteAssemblies)' != ''"
			SkipUnchangedFiles="true" />

		<!-- Copy the referenced assemblies -->
		<Copy SourceFiles="@(ReferenceCopyLocalPaths)" DestinationFolder="$(WebApplicationOutputDir)\bin" SkipUnchangedFiles="true" />
		<Copy SourceFiles="@(Content)" DestinationFolder="$(WebApplicationOutputDir)\%(Content.RelativeDir)" />
	</Target>
</Project>
