MSBuild 目标和 Visual Studio 2012 问题 [英] MSBuild targets and Visual Studio 2012 issues

查看:13
本文介绍了MSBuild 目标和 Visual Studio 2012 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难使用 Visual Studio 2012 UI 通过 Webdeploy 部署我的第三方非参考程序集.我有一个名为库"的文件夹,其中包含一些程序集.通过我的 *.csproj 文件中的以下内容,我可以将 Build Action 设置为ThirdPartyAssemblies":

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>

这很好用;当我构建时,程序集被复制到 bin 文件夹的根目录:-)现在我遇到了一个问题:我无法通过 Webdeploy 将这些文件发布到服务器.我已经尝试了很多东西,似乎我找不到适合这个任务的 MSBuild 目标......使用 Visual Studio 2010,我可以使用它:

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>

问题是;OnAfterCopyAllFilesToSingleFolderForPackage 目标不再被调用:-/

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

在深入了解 C:Program Files (x86)MSBuildMicrosoftVisualStudiov11.0WebMicrosoft.Web.Publishing.targets' 文件后,我还尝试了 'OnAfterCopyAllFilesToSingleFolderForMsdeploy,但我就是无法让它工作.

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

谁能告诉我可以使用什么目标将这些程序集复制到 Package 文件夹/使用 Webdeploy 的服务器?

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

Visual Studio 2012 为什么不将完整的 bin 文件夹复制到 Package 文件夹中?

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

推荐答案

感谢 Alexey,我找到了解决问题的方法,这就是我现在在我的 .csproj 文件中使用的,以支持为 Filesystem 复制第三方程序集-和网络部署:

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)in)" Importance="high" />
    <Copy DestinationFolder="$(_PackageTempDir)in" SourceFiles="@(ThirdPartyAssemblies)" SkipUnchangedFiles="true" />
</Target>

这篇关于MSBuild 目标和 Visual Studio 2012 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆