В файле (ах) проекта у меня есть следующее
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
, которое я не могу изменить.
Пока что мои попытки <Properties>CustomAfterMicrosoftCommonTargets=D:\Projects\OverrideCopyWebApplication.targets</Properties>
не работают.
Вот пользовательский файл .targets, который я использую:
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemDefinitionGroup>
<ProjectReference Condition="'$(OverrideCopyLocalProject)'=='true'">
<Private>False</Private>
</ProjectReference>
<Reference Condition="'$(OverrideCopyLocal)'=='true'">
<Private>False</Private>
</Reference>
</ItemDefinitionGroup>
<Target Name="_CopyWebApplication" Condition="'$(OutDir)' != '$(OutputPath)'" >
<!-- Log tasks -->
<Message Text="Overridden 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" />
<Copy SourceFiles="@(AddModules)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
<Copy SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)" DestinationFolder="$(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)" SkipUnchangedFiles="true" Condition="'$(_SGenDllCreated)'=='true'" />
<Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).pdb" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" Condition="'$(_DebugSymbolsProduced)'=='true'" />
<Copy SourceFiles="@(DocFileItem)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" Condition="'$(_DocumentationFileProduced)'=='true'" />
<Copy SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)" DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
<!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder -->
<Copy SourceFiles="@(ReferenceCopyLocalPaths)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
<Message Text="Content=$(Content)" />
<!-- Copy content files recursively to _PublishedWebsites\app\ folder -->
<Copy SourceFiles="@(Content)" DestinationFolder="$(WebProjectOutputDir)\%(Content.RelativeDir)" />
<!-- Copy items that have been marked to be copied to the bin folder -->
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectory)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectoryAlways)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="false" />
</Target>
</Project>
Я скопировал существующую цель прямо из файла проекта I 'm, пытающийся построить, указывает на и только добавил / изменил некоторые сообщения, чтобы видеть, работает ли это.Это не вызывает пользовательское переопределение.
Как мне переопределить этот импорт в файлах проекта в моем скрипте сборки?Изменения в файле (ах) проекта невозможны.Я использую MsBuild 4.0 с инструментами версии 3.5, но мне бы хотелось, чтобы она могла работать и с MsBuild3.5.