找不到MSBuild社区任务 [英] MSBuild Community Tasks not found

查看:105
本文介绍了找不到MSBuild社区任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有MyLib库项目以及几个示例.该库和示例位于相同的解决方案MySolution中.

I have MyLib library project along with several examples. The library and examples are in the same solution MySolution.

MyLib库项目中,我包含了MSBuild代码,以压缩整个解决方案并将其复制到另一个目录中以进行Internet发布.

In MyLib library project I have included MSBuild code to zip the whole solution and copy to another directory for internet publishing.

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />
  <Target Name="AfterBuild" Condition="'$(Configuration)' == 'Release'">
    <PropertyGroup>
      <ReleasePath>C:\Users\Administrator\Projects\CA\Libraries\Api-DotNet\</ReleasePath>
      <ZipFile>C:\Users\Administrator\Projects\CA\WebProject\libraries\Api-DotNet.zip</ZipFile>
    </PropertyGroup>
    <ItemGroup>
      <LibraryFiles Include="$(ReleasePath)\**\*.*" Exclude="$(ReleasePath)\**\*.user;$(ReleasePath)\**\*.suo;$(ReleasePath)\Api.*;$(ReleasePath)\**\packages\**;$(ReleasePath)\**\Lib.Test\**;$(ReleasePath)\**\*.nuspec;$(ReleasePath)\**\*.nupkg;$(ReleasePath)\**\*nuget*;$(ReleasePath)\**\*internal*;$(ReleasePath)\**\*ReSharper*\**;$(ReleasePath)\**\.svn\**;$(ReleasePath)\**\obj\**;$(ReleasePath)\lib\bin\Debug\**;$(ReleasePath)\lib\bin\Publish\**;$(ReleasePath)\Example\**\bin\**;" />
    </ItemGroup>
    <Zip Files="@(LibraryFiles)" WorkingDirectory="$(ReleasePath)" ZipFileName="$(ZipFile)" ZipLevel="9" />
  </Target>  
</Project>

问题是,当用户下载库并在另一台计算机上运行时,编译器显示错误,提示找不到导入库MSBuild.Community.Tasks.Targets.构建解决方案时,我想从项目文件中排除ZipAndCopy代码.该怎么做?

The problem is that when user download library and run on another computer the compiler show error that import library not found MSBuild.Community.Tasks.Targets. I would like to exclude ZipAndCopy code from project file when building the solution. How to do that?

推荐答案

听起来像您想要多个构建配置.我建议设置一个专门用于构建和压缩工件的文件夹,并为您的用户设置一个单独的文件夹.

Sounds like you want multiple build configurations. I would suggest setting up one specifically for building and zipping the artifacts and a separate for your users.

Release ZIP可能是您的带有内部构建事件的zip文件,而Release可能是普通的内部版本,使用社区任务并没有做任何特别的事情.

Release ZIP could be your build with the post-build-event to zip your files, and Release could be an ordinary build that doesn't do anything special using the community tasks.

这篇关于找不到MSBuild社区任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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