. net项目与项目.无法构建Json
本文关键字:项目 构建 Json net | 更新日期: 2023-09-27 17:49:02
我有。net应用程序,我正试图从
迁移 packages.config
to project.json
.
当我用Vs 2015或从命令行手动使用MsBuild构建项目时,一切都很好。当我在构建服务器上使用setup:
构建它时,问题开始发生。- 。. NET 4.51 app
- MSBuild 14.0.25402.0
- Windows Server 2012
- Microsoft Build Tools 2013, 2015 RC installed.
- 没有安装Visual Studio .
- Nuget 3.4.3.855
创建nuget restore project.lock.json时,包被下载到/用户。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
不知道为什么在build tools 2015安装后缺少这个