9

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?

4

2 に答える 2

13

解決策が見つかりました。名前を変更CopyAllFilesToSingleFolderForPackageDependsOnするだけCopyAllFilesToSingleFolderForMsdeployDependsOnで、ファイルを展開パッケージに含める必要があります。

ところで、vs12とvs 10をサポートするには両方を維持する必要があるため、これはまだ最善の解決策ではありません

于 2012-09-04T10:47:28.770 に答える