2017-01-18 1 views
0

J'ai Windows Server 2012 R2 que je veux utiliser pour générer des projets .sqlproj à partir de SSDT dans un pipeline CI. Voilà ce que je l'ai fait jusqu'à présent:Comment construire un projet SSDT sur un serveur de build "headless"?

  • Installé NuGet commandline
  • package NuGet installé Microsoft.Data.Tools.Msbuild

Quand je construis ma solution avec

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe database.solution.sln /p:tv=14 /p:SSDTPath=D:\Nuget\Microsoft.Data.Tools.Msbuild\lib\net40 /p:SQLDBExtensionsRefPath=D:\Nuget\Microsoft.Data.Tools.Msbuild\lib\net40 /p:Configuration=Debug

Je reçois un erreur en disant Could not load file or assembly 'Microsoft.Build.Utilities.Core

Des idées que j'ai manqué? L'objectif est d'avoir un serveur de construction aussi léger que possible, donc vous ne voulez pas installer Visual Studio ou SSDT dessus.

Voici le résultat complet de MsBuild:

Microsoft (R) Build Engine version 4.6.1586.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 18/01/2017 17:00:19. 
Project "D:\Jenkins\workspace\hcg\database.solution\database.solution.sln" on node 1 (default targets). 
ValidateSolutionConfiguration: 
    Building solution configuration "Debug|Any CPU". 
Project "D:\Jenkins\workspace\hcg\database.solution\database.solution.sln" (1) is building "D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj" (2) on node 1 (default targets). 
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj] 
GenerateSqlTargetFrameworkMoniker: 
Skipping target "GenerateSqlTargetFrameworkMoniker" because all output files are up-to-date with respect to the input files. 
CoreCompile: 
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:x64 /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva+ /reference:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll /debug+ /debug:full /optimize- /out:obj\Debug\database.solution.dll /subsystemversion:6.00 /target:library /warnaserror- /utf8output "C:\Users\svc_jenkins\AppData\Local\Temp\.NETFramework,Version=v4.5.2.SqlClrAttributes.cs" 
D:\Nuget\Microsoft.Data.Tools.Msbuild\lib\net40\Microsoft.Data.Tools.Schema.SqlTasks.targets(477,5): error MSB4062: The "SqlModelResolutionTask" task could not be loaded from the assembly D:\Nuget\Microsoft.Data.Tools.Msbuild\lib\net40\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj] 
Done Building Project "D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj" (default targets) -- FAILED. 
Done Building Project "D:\Jenkins\workspace\hcg\database.solution\database.solution.sln" (default targets) -- FAILED. 

Build FAILED. 

"D:\Jenkins\workspace\hcg\database.solution\database.solution.sln" (default target) (1) -> 
"D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj" (default target) (2) -> 
(GetReferenceAssemblyPaths target) -> 
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(983,5): warning MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.5.2" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj] 


"D:\Jenkins\workspace\hcg\database.solution\database.solution.sln" (default target) (1) -> 
"D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj" (default target) (2) -> 
(_SetupSqlBuildInputs target) -> 
    D:\Nuget\Microsoft.Data.Tools.Msbuild\lib\net40\Microsoft.Data.Tools.Schema.SqlTasks.targets(477,5): error MSB4062: The "SqlModelResolutionTask" task could not be loaded from the assembly D:\Nuget\Microsoft.Data.Tools.Msbuild\lib\net40\Microsoft.Data.Tools.Schema.Tasks.Sql.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\Jenkins\workspace\hcg\database.solution\database.solution\database.solution.sqlproj] 

    1 Warning(s) 
    1 Error(s) 

Time Elapsed 00:00:00.51 

Répondre

1

Le paquet SSDT NuGet Version MSBuild 14,0 attend Mise à jour 3 ou plus récent (à savoir le RC 15.0). C'est disponible ici: https://www.microsoft.com/en-us/download/details.aspx?id=48159

Vous aurez également besoin de définir des variables d'environnement pour faire référence à l'emplacement du package NuGet, comme ceci: setx SQLDBExtensionsRefPath C:\agent\Microsoft.Data.Tools.Msbuild\lib\net40 /M setx SSDTPath C:\agent\Microsoft.Data.Tools.Msbuild\lib\net40 /M

lien de référence: https://blogs.msdn.microsoft.com/ssdt/2016/08/22/releasing-ssdt-with-visual-studio-15-preview-4-and-introducing-ssdt-msbuild-nuget-package/

+0

Merci, l'installation MSBuildTools2015 et référencement MSBuild dans ce chemin l'a résolu. –