W
W
wrmax2014-01-16 16:05:47
visual studio
wrmax, 2014-01-16 16:05:47

visual studio. Setting up a Publish Profile to copy files not included in the project to the Publish folder

Now there is the following setting

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>D:\publish\WebApplication1</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
  </PropertyGroup>
  <Target Name="AdditionalFilesForPackage" AfterTargets="CopyAllFilesToSingleFolderForPackage">
    <Message Text="AdditionalFilesForPackage" Importance="high"/>
    <Copy SourceFiles="$(ProjectDir)\test.txt" DestinationFolder="$(publishUrl)" />
  </Target>
</Project>

And the actions go in this order
AdditionalFilesForPackage (the file is copied here)
Deleting existing files...
Publishing folder /...
What should be specified instead of CopyAllFilesToSingleFolderForPackage so that the file is copied after Deleting existing files is executed?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wrmax, 2014-01-19
@wrmax

<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121. 
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>E:\Publish</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
  </PropertyGroup>
  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <!-- =====Root folder ==== -->
      <_CustomFilesForRootFolder Include="BuiltScripts\*.js">
        <DestinationRelativePath>%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </_CustomFilesForRootFolder>
      <FilesForPackagingFromProject Include="%(_CustomFilesForRootFolder.Identity)">
        <DestinationRelativePath>MyScript\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>
</Project>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question