我正在使用网站的visual studio 2012包功能,并且在压缩文件夹之前,我有一个自定义目标将一些子文件夹收集到包目标中。这曾经在vs10中工作得很好,但是在新的打包程序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>
在新项目中完全忽略了这一点。做类似事情的好方法是什么?
发布于 2012-09-04 18:47:29
找到一个解决方案,只需将CopyAllFilesToSingleFolderForPackageDependsOn
重命名为CopyAllFilesToSingleFolderForMsdeployDependsOn
,文件应包含在部署包中。
顺便说一句,这仍然不是最好的解决方案,因为您需要同时维护这两个解决方案来支持vs12和VS10
发布于 2014-05-14 05:18:02
还有另一种方法,它也有效,并且需要更少的维护。
<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>
https://stackoverflow.com/questions/12235449
复制相似问题