我正在使用视觉工作室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>
这在新项目中完全被忽视.做一些类似的东西有什么好办法?
解决方法
找到一个解决方案,只需将CopyAllFilesToSingleFolderForPackageDependsOn重命名为CopyAllFilesToSingleFolderForMsdeployDependsOn,并将这些文件包含在部署包中.
BTW这还不是最好的解决方案,因为你需要维护两者来支持vs12和vs 10
