Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CopyAllFilesToSingleFolderForPackageDependsOn no longer supported by vs12

I am using the visual studio 2012 package feature for websites, and I have a custom target to collect some sub folders into the package destination prior to zipping the folder.. This used to work well in vs10 but with the new packager vs12 it not longer cares about any of these configurations and they haven't been migrated correctly any way to do something similar so my package will eventually have these files?

This is what it used to look like in vs10:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <!-- Begin copy Contracts &Provider directories -->
    <CopyAllFilesToSingleFolderForPackageDependsOn>
      CustomCollectFiles;
      $(CopyAllFilesToSingleFolderForPackageDependsOn);
    </CopyAllFilesToSingleFolderForPackageDependsOn>
    <DesktopBuildPackageLocation>..\Package\Release\projectname.zip</DesktopBuildPackageLocation>
    <DeployIisAppPath>projectname</DeployIisAppPath>
    <!-- End copy Contracts &Provider directories -->
  </PropertyGroup>

  <Target Name="CustomCollectFiles">
    <ItemGroup>
      <_CustomFiles Include="$(OutputPath)\Contracts\**\*" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\Contracts\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
    <ItemGroup>
      <_CustomFiles Include="$(OutputPath)\Providers\**\*" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\Providers\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>

This is completely ignored in the new project. What's a good method to do something similar?

like image 691
aromasca Avatar asked Sep 02 '12 11:09

aromasca


2 Answers

Found a solution, just rename CopyAllFilesToSingleFolderForPackageDependsOn to CopyAllFilesToSingleFolderForMsdeployDependsOn and the files should be included in the deployment package.

BTW this still isnt the best solution since you need to maintain both to support vs12 & vs 10

like image 178
aromasca Avatar answered Oct 31 '22 02:10

aromasca


Yet another approach which also works and requires less maintenance..

  <Target Name="CustomFolderDeploy" AfterTargets="CopyAllFilesToSingleFolderForPackage" BeforeTargets="MSDeployPublish">
    <PropertyGroup>
      <CustomFolder>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)\..\..\..\Lib\CustomFolder'))</CustomFolder>
    </PropertyGroup>
    <CreateItem Include="$(CustomFolder)\*.*">
      <Output TaskParameter="Include" ItemName="CustomFiles" />
    </CreateItem>
    <Copy SourceFiles="@(CustomFiles)" DestinationFolder="$(MSBuildProjectDirectory)\obj\$(Configuration)\Package\PackageTmp\bin" SkipUnchangedFiles="True" ContinueOnError="False" />
  </Target>
like image 23
Ostati Avatar answered Oct 31 '22 01:10

Ostati