Question

I'm having a hard time getting my third party non-reference assemblies deployed via Webdeploy withing the Visual Studio 2012 UI. I have a folder called 'libraries', which contains some assemblies. Via the following in my *.csproj file I can set the Build Action to 'ThirdPartyAssemblies':

<ItemGroup>
  <AvailableItemName Include="ThirdPartyAssemblies">
    <Visible>false</Visible>
  </AvailableItemName>
</ItemGroup>
<Target Name="AfterBuild">
  <Message Text="Build | Third party assemblies" Importance="high" />
  <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>

This works great; when I build, the assemblies get copied to the root of the bin folder :-) Now I've got one problem: I can not get these files published to the server via Webdeploy. I've tried many things, it just seems like I can not find a suitable MSBuild target for this task... With Visual Studio 2010 I could use this:

<Target Name="MyTargetName">
  <Message Text="Deploy | Third party assemblies" Importance="high" />
  <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>
<PropertyGroup>
  <OnAfterCopyAllFilesToSingleFolderForPackage>
    MyTargetName
  </OnAfterCopyAllFilesToSingleFolderForPackage>
</PropertyGroup>

The problem is; the OnAfterCopyAllFilesToSingleFolderForPackage target isn't called anymore :-/

After digging into the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets' file, I've also tried 'OnAfterCopyAllFilesToSingleFolderForMsdeploy, but I just can't get it to work.

Can anyone tell me what target I can use to copy those assemblies to the Package folder / the server with Webdeploy?

Why doesn't Visual Studio 2012 copy the complete bin folder to the Package folder?

Was it helpful?

Solution

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>

OTHER TIPS

You are using vs2012 and this mean you have shiny new msbuild 4.0 =). It's much simplier to hook your target call with new AfterTargets attribute. You can check my answer on this question for usage example.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top