MSBuild目标和Visual Studio 2012问题 [英] MSBuild targets and Visual Studio 2012 issues
问题描述
我很难通过Visual Studio 2012 UI通过Webdeploy部署第三方非参考程序集. 我有一个名为"libraries"的文件夹,其中包含一些程序集. 通过* .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)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets' file, I've also tried 'OnAfterCopyAllFilesToSingleFolderForMsdeploy
之后,但我无法使其正常工作.
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.
任何人都可以告诉我使用Webdeploy将这些程序集复制到Package文件夹/服务器的目标吗?
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-的第三方程序集.和Webdeploy:
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>
这篇关于MSBuild目标和Visual Studio 2012问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!