TFS 2015 Build以错误的顺序构建解决方案及其项目(ASP.NET Core Framework 4.6.1)

时间:2016-12-09 14:48:15

标签: asp.net tfs msbuild .net-core

我有Asp.Net核心(Framework 4.6.1)解决方案,具有以下结构:

API sln

| - WebApi.Project_1

     |-- Project_2 (Core library, referencing Framework 4.6.1)
                references Project_4 (Core Library, referencing Framework 4.6.1)
     |-- Project_3 (Core library, referencing Framework 4.6.1)
                 references Project_4 (Core Library, referencing Framework 4.6.1)

参见"已消毒"下面的project.json文件。

一些注意事项:

•解决方案中添加了许多经典(4.6.1 .net)库,但尚未被任何其他核心项目引用。

•我创建了核心库,并从他们的json文件中手动引用了.net framework 4.6.1

•他们使用x86平台,在project.json中指定 - > buildOptions

使用VisualStudio 2015(在我的本地计算机上或本地在同一构建代理服务器上)构建并运行一切正常

在TFS 2015构建引擎构建CI时,解决方案构建失败,并出现以下错误:

" C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ DotNet \ Microsoft.DotNet.Common.Targets(265,5):错误:D :\ tfsAgent_work \ folder \ folder \ Project_2 \ error CS0006:元数据文件' \ folder \ folder \ bin \ debug \ net461 \ Project_4.dll'无法找到"

相同的错误,但是对于Project_3,也引用了Project_4。

通过查看构建日志,我看到 Project_4是在项目2和3之后构建的,因此文件还没有。

我尝试了不同的选择:

•在project.json中添加引用

•使用项目参考

•解决方案属性 - >项目依赖...

•在API.sln文件中手动重新排序项目。

没有区别。

**WebApi_Project_1.json:**

 {
  "dependencies": {
    "Project_2": "1.0.0-*",
    "Project_3": "1.0.0-*",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "System.Net.Http": "4.1.0"
  },

 "tools": {
     "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
   },

   "frameworks": {
      "net461": {}
   },

   "buildOptions": {
     "emitEntryPoint": true,
     "preserveCompilationContext": true,
     "platform": "x86",
     "copyToOutput": {
       "include": [
         "Folder/Folder/Folder/*.xsd",
         "Folder/Folder/Folder/*.xml"
       ]
     }
   },

   "publishOptions": {
     "include": [
       "wwwroot",
       "Views",
       "Areas/**/Views",
       "appsettings.json",
       "web.config"
     ]
   },

   "scripts": {
     "postpublish": [ "dotnet publish-iis --publish-folder %     publish:OutputPath% --framework %publish:FullTargetFramework%" ]
   }
 }


 **Project_2.json**

 {
   "dependencies": {
     "Project_4": "1.0.0.0"
   },

   "buildOptions": {"platform": "x86"},

   "frameworks": {
     "net461": {}
     }

   }


**Project_3.json**
{

  "buildOptions": { "platform": "x86" },

  "dependencies": {

    "Project_4": "1.0.0.0"

  },

   "frameworks": {
    "net461": {
      "frameworkAssemblies": {
        "System.Xml": "4.0.0.0"
      }
    }
  }
}


**Project_4.json**

{
  "version": "1.0.0.0",
  "buildOptions": { "platform": "x86" },
  "frameworks": {
    "net461": {}
  }
}

0 个答案:

没有答案