使用csc命令编译c#项目

时间:2017-11-09 10:36:51

标签: c# msbuild .net-core csc

我有一个引用netstandard2.0项目的.net 4.6.1项目(使用新的csproj格式)。 构建此项目时,我会在输出中出现错误,但不会出现在Visual Studio 2017的UI或错误列表中(版本15.4.3)。

输出中列出的错误是

 The type or namespace name 'Services' does not exist in the namespace

我使用msbuild /bl构建了项目并使用了structured log viewer 查看用于编译项目的实际命令。 命令很长(25000+个字符) 我将此命令放在bat文件中并运行它返回:

 error CS0006: Metadata file 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\ref\SystemDiagnostics.StackTrace.dll' could not be found

error CS0006: Metadata file 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\Microsoft.NET.Build.Extensions\net461\ref\System.Runime.dll' could not be found

error CS0006: Metadata file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v46.1\Facades\System.ServiceModel.Primitives.dll' could not be found

这些库是通过/reference csc参数引用的,但输出中的错误名称略有错误:

  

SystemDiagnostics.StackTrace.dll 而不是   System.Diagnostics.StackTrace.dll

     

System.Runime.dll 而不是System.Runtime.dll

     

.NETFramework \ v46.1 \ Facades \ System.ServiceModel.Primitives.dll   .NETFramework \ v4.6.1 \ Facades \ System.ServiceModel.Primitives.dll

为什么csc会尝试找到那些错误的错位名称而不是实际引用的dll?

PS :long csc命令的Services中缺少包含/refferences命名空间的netstandard2.0 dll。

0 个答案:

没有答案
相关问题