6

我正在尝试为我们的新项目的 CI 设置我们的 Hundson 服务器。一切运行良好,构建项目、单元测试和 FxCop 检查运行。但是当我尝试使用 StyleCop 检查代码时,会发生错误。首先:我们在 C# 中使用 MS VS 2010 进行开发,在 Hudson Server 上安装了 .Net 4.0 和 Windows SDK 7.1。

现在我已将 StyleCop.Targets 添加到我的 SVN 并将 .cproj 文件链接到该文件。如果我在 VS2010 中构建一切都很好,除了 StyleCop 警告,但如果 Hundson 服务器尝试构建项目,则会发生此错误:

error MSB4062: The "StyleCopTask" task could not be loaded from the assembly 
C:\Program Files (x86)\MSBuild\..\StyleCop 4.7\StyleCop.dll. Could not load file or
assembly 'Microsoft.Build.Utilities.v3.5, Version=3.5.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot 
find the file specified. Confirm that the <UsingTask> declaration is correct, 
that the assembly and all its dependencies are available, and that the task 
contains a public class that implements Microsoft.Build.Framework.ITask. 

StyleCop.dll 在 Hundson 服务器的路径中,有人可以告诉我我做错了什么吗?

4

1 回答 1

1
  1. 转到控制面板\程序\程序和功能
  2. 选择打开或关闭 Windows 功能
  3. 单击 .NET Framework 3.5(包括 .NET 2.0 和 3.0)
  4. 单击确定并等待
  5. 重新启动 Visual Studio

那应该解决它

于 2017-06-07T23:05:21.443 回答