繁体   English   中英

无法构建带有project.json的.NET项目

[英].NET project with project.json cannot be built

我有.net应用程序,我正在尝试从中迁移

packages.configproject.json

当我使用Vs 2015构建项目或从命令行手动使用MsBuild时,一切正常。 当我使用设置在构建服务器上构建时,问题就开始发生了:

  1. .NET 4.51应用程序
  2. MSBuild 14.0.25402.0
  3. Windows Server 2012
  4. 安装了Microsoft Build Tools 2013,2015 RC。
  5. 没有安装Visual Studio。
  6. Nuget 3.4.3.855

当正在创建nuget restore project.lock.json时,将包下载到user / .nuget / packages,这样看起来它正在完成这项工作。 然后我试图运行MSBuild,我收到很多引用错误:

error CS0246: The type or namespace name 'log4net' could not be found (are you missing a using directive or an assembly reference?)

当我从开发人员机器使用MSBuild时,即使我指向构建服务器目录,我也可以构建这个项目,因此这是MSBuild的一个明显问题。 我想微软构建工具缺少一些东西,任何想法?

编辑:看起来msbuild在我的开发人员计算机上添加了所有nuget路径的标记/引用,并且在构建服务器计算机上没有这样做。 例:

 /reference:C:\Users\user\.nuget\packages\log4net\1.2.10\lib\log4net.dll

构建项目的开发者机器:

Build started 27/06/2016 13:29:40.
Project "Y:\13dd0660b4e0a7a0\project.Shared.Utilities\project.Shared.Utilities.csproj" on node 1 (default targets).
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
  C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:C:\Users\username\.nuget\packages\EPPlus\4.0.4\lib\net20\EPPlus.dll

构建服务器msbuild构建同一个项目

D:\13dd0660b4e0a7a0\project.Shared.Utilities>"C:\Program Files (x86)"\MSBuild\14.0\Bin\msbuild project.shared.utilities.csproj
Microsoft (R) Build Engine version 14.0.25123.0
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 27/06/2016 12:35:19.
Project "D:\13dd0660b4e0a7a0\project.Shared.Utilities\project.shared.utilities.csproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "bin\Debug\".
  Creating directory "obj\Debug\".
GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
CoreCompile:
  C:\Program Files (x86)\MSBuild\14.0\bin\csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\mscorlib.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.ComponentModel.DataAnnotations.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\System.Configuration.dll" 

这只是日志的一部分 - >你可以看到/ reference被传递给第一个脚本

我找到了解决方案。 如果缺少,将内容从开发人员计算机复制到构建服务器计算机上的相应目

C:\Program Files (x86)\MSBuild\Microsoft\NuGet

在构建工具2015安装之后,不确定为什么会丢失它。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM