问题
With Visual Studio 2010 I used the _bin_deployableAssemblies folder to include third party assemblies which should be included in the bin folder on build and web deploy. It's about those third party assemblies which are needed for the website, but you don't want to reference them. This worked awesome...
Now with Visual Studio 2012 it stopped working... Well, a part of it stopped working. When I build, the contents of the _bin_deployableAssemblies folder are copied to the bin folder. But when I execute webdeploy, for instance to my local disk, those files are not published to the output folder's bin folder.
I'm using this in my .csproj file:
<PropertyGroup>
<OnAfterCopyAllFilesToSingleFolderForPackage>
__MoveFilesFromUmbracoSubdirsToBinPackageTemp
</OnAfterCopyAllFilesToSingleFolderForPackage>
</PropertyGroup>
<Target Name="_CopyBinDeployableAssemblies" Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')">
<CreateItem Include="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\*.*" Condition="Exists('$(MSBuildProjectDirectory)\_bin_deployableAssemblies')" Exclude="$(MSBuildProjectDirectory)\_bin_deployableAssemblies\**\.svn\**\*">
<Output ItemName="_binDeployableAssemblies" TaskParameter="Include" />
</CreateItem>
<Copy SourceFiles="@(_binDeployableAssemblies)" DestinationFolder="$(OutDir)" SkipUnchangedFiles="true" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" />
</Target>
<Target Name="__MoveFilesFromUmbracoSubdirsToBinPackageTemp">
<Message Text="Moving files from bin\umbraco\ and bin\umbraco plugins\ to bin\" Importance="high" />
<CreateItem Include="$(_PackageTempDir)\bin\umbraco\*.*;$(_PackageTempDir)\bin\umbraco plugins\*.*">
<Output ItemName="_umbracoItems" TaskParameter="Include" />
</CreateItem>
<Move SourceFiles="@(_umbracoItems)" DestinationFolder="$(_PackageTempDir)\bin" />
<Message Text="Removing bin\umbraco\ and bin\umbraco plugins\ folders" Importance="high" />
<RemoveDir Directories="$(_PackageTempDir)\bin\umbraco;$(_PackageTempDir)\bin\umbraco plugins" />
</Target>
Could anyone help me out how I get those assemblies in the ouput folder's bin folder?
回答1:
Thanks to Alexey I found the solution to my problem, this is what I'm using now in my .csproj file to support copying third party assemblies for Filesystem- and Webdeploy:
<ItemGroup>
<AvailableItemName Include="ThirdPartyAssemblies">
<Visible>false</Visible>
</AvailableItemName>
</ItemGroup>
<Target Name="AfterBuild">
<Message Text="Build | Copying third party assemblies to output folder ($(OutputPath))" Importance="high" />
<Copy DestinationFolder="$(OutputPath)" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>
<Target Name="CopyBinFiles" AfterTargets="CopyAllFilesToSingleFolderForPackage" BeforeTargets="MSDeployPublish">
<Message Text="Deploy | Copying third party assemblies to output folder ($(_PackageTempDir)\bin\)" Importance="high" />
<Copy DestinationFolder="$(_PackageTempDir)\bin\" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>
From: MSBuild targets and Visual Studio 2012 issues
回答2:
Assuming you have Only files needed to run this application set in project properties, make sure that the files are included in the project and that their Build Action is Content.
http://msdn.microsoft.com/en-us/library/ee942158.aspx#why_dont_all_files_get_deployed
来源:https://stackoverflow.com/questions/12389368/using-bin-deployableassemblies-with-visual-studio-2012