vs12不再支持CopyAllFilesToSingleFolderForPackageDependsOn

aro*_*sca 9 msbuild package asp.net-mvc-3 .net-4.5 visual-studio-2012

我正在为网站使用visual studio 2012软件包功能,我有一个自定义目标,在压缩文件夹之前将一些子文件夹收集到软件包目的地..这曾经在vs10中运行良好但是使用新的packager vs12它不再关心任何这些配置,他们没有正确迁移任何类似的东西,所以我的包最终会有这些文件?

这是它在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>
Run Code Online (Sandbox Code Playgroud)

在新项目中完全忽略了这一点.做类似事情的好方法是什么?

aro*_*sca 13

找到一个解决方案,只需重命名CopyAllFilesToSingleFolderForPackageDependsOn,CopyAllFilesToSingleFolderForMsdeployDependsOn文件应该包含在部署包中.

顺便说一句,这仍然不是最佳解决方案,因为你需要同时支持vs12和vs 10