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?
Found a solution, just rename CopyAllFilesToSingleFolderForPackageDependsOn
to CopyAllFilesToSingleFolderForMsdeployDependsOn
and the files should be included in the deployment package.
BTW this still isnt the best solution since you need to maintain both to support vs12 & vs 10
Yet another approach which also works and requires less maintenance..
<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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With