Laden...

[erledigt] Jenkins: Build errors; VS: keine Errors

Erstellt von Yeats vor 6 Jahren Letzter Beitrag vor 6 Jahren 2.375 Views
Y
Yeats Themenstarter:in
102 Beiträge seit 2005
vor 6 Jahren
[erledigt] Jenkins: Build errors; VS: keine Errors

Hallo,

Zur Zeit versuche ich mir Jenkins zu konfigurieren. Dazu habe ich das MSBuild Plugin installiert. Anschließend mit dem Git-Repository verbunden und ein Projekt angelegt.
Ohne die Ausführung der UnitTests, nur als BuildServer, hat es problemlos geklappt.
Anschließend wollte ich noch die UnitTests ausführen lassen. Dazu NUnit auf dem Rechner installiert, NUnit Plugin installiert, den MSBuild Pfad in Jenkins angegeben und anschließend beides zusammen im Build Prozess angegeben.

Allerdings bekomme ich nun beim Kompilieren Fehler durch MSBuild die ich beim Kompilieren mit Visual Studio oder Rider nicht bekomme.

Das Projekt baut auf Framework 4.7 auf.

Folgend ist ein Auszug aus dem Jenkins Output.


C:\Jenkins\Workspace\Continuity>C:\temp\nuget.exe restore 
MSBuild auto-detection: using msbuild version '15.5.180.51428' from 'C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\bin'.
Restoring NuGet....

C:\Jenkins\Workspace\Continuity>exit 0 
Path To MSBuild.exe: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe
Executing the command cmd.exe /C " chcp 1252 & C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe Continuity.sln " && exit %%ERRORLEVEL%% from C:\Jenkins\Workspace\Continuity
[Continuity] $ cmd.exe /C " chcp 1252 & C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe Continuity.sln " && exit %%ERRORLEVEL%%
Active code page: 1252
Microsoft (R) Build Engine version 4.7.2558.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 07.01.2018 13:36:09.
Project "C:\Jenkins\Workspace\Continuity\Continuity.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Debug|Any CPU".
Project "C:\Jenkins\Workspace\Continuity\Continuity.sln" (1) is building "C:\Jenkins\Workspace\Continuity\Continuity\Continuity.csproj" (2) on node 1 (default targets).
Project file contains ToolsVersion="12.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0". For more information, please see http://go.microsoft.com/fwlink/?LinkId=291333.
PrepareForBuild:
  Creating directory "bin\Debug\".
  Creating directory "obj\Debug\".
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3267: The primary reference "System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.7". To resolve this problem, either remove the reference "System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". [C:\Jenkins\Workspace\Continuity\Continuity\Continuity.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3257: The primary reference "System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" could not be resolved because it has a higher version "4.1.2.0" than exists in the current target framework. The version found in the current target framework is "4.0.0.0". [C:\Jenkins\Workspace\Continuity\Continuity\Continuity.csproj]
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(1605,5): warning MSB3267: The primary reference "System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.7". To resolve this problem, either remove the reference "System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" or retarget your application to a framework version which contains "System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL". [C:\Jenkins\Workspace\Continuity\Continuity\Continuity.csproj]
GenerateTargetFrameworkMonikerAttribute:
...

BaseClasses\SlExcelStatus.cs(7,29): error CS1002: ; expected [C:\Jenkins\Workspace\Continuity\Continuity\Continuity.csproj]

Hat jemand da eine Idee dazu?
mfg

4.931 Beiträge seit 2008
vor 6 Jahren

Hallo,

Zeile 20 des Logs ist entscheidend, d.h. die ToolsVersion "12.0" (VS 2013) ist in der Projektdatei eingetragen, es wird aber "15.0" (für VS 2017) gebraucht (s.a. MSBuild-Toolset (ToolsVersion)).

Zum Überschreiben s. Overriding ToolsVersion Settings.

Y
Yeats Themenstarter:in
102 Beiträge seit 2005
vor 6 Jahren

Habe die ToolsVersion auf 15 geändert.
Damit bekomme ich diese Meldung.> Fehlermeldung:

This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0".

Auf dem Rechner ist allerdings Visual Studio 2017 Community installiert.

Hinweis von Abt vor 6 Jahren

Bitte nach über 10 Jahren im Forum die korrekten BBCodes verwenden.

16.807 Beiträge seit 2008
vor 6 Jahren

Die Fehlermeldung zeigt eigentlich, dass die Build Tools in der von Dir gewünschten Version nicht (korrekt) installiert sind.
Evtl. muss in Jenkins hier noch der Pfad angepasst werden?

Die Angabe Visual Studio 2017 alleine reicht auch nicht; denn es kommt hier oft auf den Patch-Stand von VS2017 an; sprich welche Update-Version dazu installiert ist.
Auch sind die Build Tools eine eigene Installation und nicht direkt in Zusammenhang mit Visual Studio (2017).

Und wie Th69 bereits gesagt hat: teste mal die Override Settings (/tv:15.0)

Y
Yeats Themenstarter:in
102 Beiträge seit 2005
vor 6 Jahren

Danke Abt,
Danke Th69

Der Pfad zu MSBuild war falsch konfiguriert.