我正在將項目轉換爲新的.csproj
格式,並將其設置爲同時針對netstandard2.0和net45。它在我的機器上運行良好,但是在嘗試構建netstandard2.0時,在構建服務器上失敗。 net45的構建無錯地運行。部分日誌:.Net標準2.0構建在Teamcity上失敗
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin\Roslyn\csc.exe <lots of parameters>
Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\bin\Roslyn
error CS0234: The type or namespace name 'Serialization' does not exist in the namespace 'System.Runtime' (are you missing an assembly reference?)
error CS0246: The type or namespace name 'BinaryFormatter' could not be found (are you missing a using directive or an assembly reference?)
error CS0246: The type or namespace name 'ICloneable' could not be found (are you missing a using directive or an assembly reference?)
我知道這些類型在版本2.0之前不存在,但它不清楚它是如何找不到它們的。 .Net Core 2.0 SDK似乎安裝在構建服務器上,除此之外,我嘗試使用較低版本的SDK來運行它,並明確告訴我要定位不同版本的標準。據我所知,從版本2.0開始,不需要對項目文件中的標準庫進行顯式依賴。
這些錯誤的原因是什麼?
我們使用由TeamCity MsBuild build Runner運行的MsBuild腳本,其ToolsVersion = 15.0。
是一個的NuGet恢復到的MSBuild調用之前執行(例如'的MSBuild /噸:Restore') –
是的,我們使用內置在解決方案文件中的MsBuild目標'恢復'它在我的機器上的一個乾淨的回購做所有的工作 – holdn
「很多參數」是否包含對'netstandard.dll'的引用?至少應該定義ICloneable在那裏 –