9

웹 사이트에 visual studio 2012 패키지 기능을 사용하고 있으며 폴더를 압축하기 전에 패키지 대상에 일부 하위 폴더를 수집하는 사용자 지정 대상이 있습니다. 잘 작동하는 데 사용됩니다. vs10이지만 새로운 패키지 도구 vs12에서는 더 이상 이러한 구성을 신경 쓰지 않고 올바르게 마이그레이션되지 않았습니다. 비슷한 방식으로 어떤 방법 으로든 내 패키지에 결국이 파일이 저장됩니다.CopyAllFilesToSingleFolderForPackageDependsOn 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> 

이 완전히 새로운 프로젝트에 무시됩니다. 비슷한 것을하기위한 좋은 방법은 무엇입니까?

답변

13

해결 방법을 찾았다면 CopyAllFilesToSingleFolderForPackageDependsOnCopyAllFilesToSingleFolderForMsdeployDependsOn으로 바꾸고 파일을 배포 패키지에 포함해야합니다. 당신은 모두 10

2

또한 작품과 적은 유지 보수를 필요로 또 다른 방법 대 vs12 &를 지원하기 위해 유지할 필요가 있기 때문에

은 BTW이 아직

<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> 
+1

이는 것 같다 .. 최상의 솔루션을 밤은 좋은 솔루션이지만 VS 2013에서는 작동하지 않습니다. BeforeTargets/AfterTargets는 .pubxml 파일에서 무시됩니다. – nZeus

+0

@nZeus 저는 일반적으로 이러한 문제로 인해 게시를 피하려고합니다. MSBuild 스크립트를 만들고 그렇게 할 수 있습니다 , 그러면 작동합니다. – ostati

관련 문제