1
votes

I have a .net Core app in VS2017 that also has a Database Project in the solution as well.

I want to set up continuous integration within Visual Studio Team Services to Build and Publish both the app and the database project. I have been able to get either the database project or app in the Publish Artifacts, but can't get them both at the same time. I am assuming I have set up my paths up wrong, but I have not had an luck with any of the combinations I have tried and there is very little documentation that I can find on having both an .net core app and a database project build and deploy together. How do I build and publish both the .net core app and the database project together in VSTS?

Below is the current set up I have in VSTS for the Build. I currently was trying to put the database project in one folder ($(build.artifactstagingdirectory)) and the app in another folder since resulted in

List of current steps

Below is the output from the current setup as seen in the image above


Starting: Build

******************************************************************************

Task : .NET Core Description : Build, test and publish using dotnet core command-line. Version : 1.0.2

Author : Microsoft Corporation

"C:\Program Files\dotnet\dotnet.exe" build d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj --configuration release Microsoft (R) Build Engine version 15.1.1012.6693 Copyright (C) Microsoft Corporation. All rights reserved. DatabaseDeploymentTest.web -> d:\a\1\s\DatabaseDeploymentTest.web\bin\release\netcoreapp1.1\DatabaseDeploymentTest.web.dll Build succeeded. 0 Warning(s) 0 Error(s) Time Elapsed 00:00:07.50


Finishing: Build



Starting: Build solution **/*.sln

******************************************************************************

Task : MSBuild Description : Build with MSBuild Version : 1.120.0

Author : Microsoft Corporation

"D:\a_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.120.0\ps_modules\MSBuildHelpers\vswhere.exe" -version [15.0,16.0) -latest -format json "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe" "d:\a\1\s\DatabaseDeploymentTest.sln" /nologo /nr:false /dl:CentralLogger,"D:\a_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll";"RootDetailId=|SolutionDir=d:\a\1\s"*ForwardingLogger,"D:\a_tasks\MSBuild_c6c4c611-aa2e-4a33-b606-5eaba2196824\1.120.0\ps_modules\MSBuildHelpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll" /t:build /p:CmdLineInMemoryStorage=True /p:_MSDeployUserAgent="VSTS_8786b412-4ab0-4ae3-aa96-af0394363b64_build_32_835" Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. Build started 8/7/2017 6:40:49 PM. Project "d:\a\1\s\DatabaseDeploymentTest.sln" on node 1 (build target(s)). ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU". Project "d:\a\1\s\DatabaseDeploymentTest.sln" (1) is building "d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj" (2) on node 1 (default targets). PrepareForBuild: Creating directory "bin\Debug\". Creating directory "obj\Debug\". CoreCompile: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\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.2\mscorlib.dll" /debug+ /debug:full /optimize- /out:obj\Debug\DatabaseDeploymentTest.dll /ruleset:"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Team Tools\Static Analysis Tools\Rule Sets\MinimumRecommendedRules.ruleset" /subsystemversion:6.00 /target:library /warnaserror- /utf8output "d:\a_temp.NETFramework,Version=v4.5.2.SqlClrAttributes.cs" Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn SqlBuild: Creating a model to represent the project... Loading project references... Loading project files... Building the project model and resolving object interdependencies... Validating the project model... Writing model to d:\a\1\s\DatabaseDeploymentTest\obj\Debug\Model.xml... DatabaseDeploymentTest\dbo\Stored Procedures\LoadEmployees.sql(1,1): Warning SQL71558: The object reference [dbo].[Employees].[HKSEmployeeId] differs only by case from the object definition [dbo].[Employees].[HKSEmployeeID]. d:\a\1\s\DatabaseDeploymentTest\dbo\Stored Procedures\LoadEmployees.sql(1,1,1,1): Build warning SQL71558: The object reference [dbo].[Employees].[HKSEmployeeId] differs only by case from the object definition [dbo].[Employees].[HKSEmployeeID]. [d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj] CopyFilesToOutputDirectory: Copying file from "obj\Debug\DatabaseDeploymentTest.dll" to "bin\Debug\DatabaseDeploymentTest.dll". DatabaseDeploymentTest -> d:\a\1\s\DatabaseDeploymentTest\bin\Debug\DatabaseDeploymentTest.dll Copying file from "obj\Debug\DatabaseDeploymentTest.pdb" to "bin\Debug\DatabaseDeploymentTest.pdb". SqlPrepareForRun: DatabaseDeploymentTest -> d:\a\1\s\DatabaseDeploymentTest\bin\Debug\DatabaseDeploymentTest.dacpac Done Building Project "d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj" (default targets). Project "d:\a\1\s\DatabaseDeploymentTest.sln" (1) is building "d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj" (3) on node 1 (default targets). PrepareForBuild: Creating directory "bin\Debug\netcoreapp1.1\". Creating directory "obj\Debug\netcoreapp1.1\". PreComputeCompileTypeScript: C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.2\tsc.exe --noEmitOnError --listEmittedFiles CompileTypeScript: C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.2\tsc.exe --noEmitOnError --listEmittedFiles GenerateTargetFrameworkMonikerAttribute: Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files. CoreCompile: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn\csc.exe /noconfig /unsafe- /checked- /nowarn:1701,1702,1705 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;DEBUG;NETCOREAPP1_1 /reference:C:\Users\buildguest.nuget\packages\microsoft.applicationinsights.aspnetcore\2.0.0\lib\netstandard1.6\Microsoft.ApplicationInsights.AspNetCore.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.applicationinsights\2.2.0\lib\netstandard1.5\Microsoft.ApplicationInsights.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.antiforgery\1.1.1\lib\netstandard1.3\Microsoft.AspNetCore.Antiforgery.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.authorization\1.1.1\lib\netstandard1.3\Microsoft.AspNetCore.Authorization.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.cors\1.1.1\lib\netstandard1.3\Microsoft.AspNetCore.Cors.dll /reference:C:\Users\buildguest.nuget\packages\microsoft.aspnetcore.cryptography.internal\1.... Using shared compilation with compiler from directory: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Roslyn GetTypeScriptCopyToOutputDirectoryItems: Adding items with BuildAction=TypeScriptCompile to the same collections that will be populated (with items of other BuildActions) by the GetCopyToOutputDirectoryItems target CopyFilesToOutputDirectory: Copying file from "obj\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.dll" to "bin\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.dll". DatabaseDeploymentTest.web -> d:\a\1\s\DatabaseDeploymentTest.web\bin\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.dll Copying file from "obj\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.pdb" to "bin\Debug\netcoreapp1.1\DatabaseDeploymentTest.web.pdb". Done Building Project "d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj" (default targets). Done Building Project "d:\a\1\s\DatabaseDeploymentTest.sln" (build target(s)). Build succeeded. "d:\a\1\s\DatabaseDeploymentTest.sln" (build target) (1) -> "d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj" (default target) (2) -> (SqlBuild target) -> d:\a\1\s\DatabaseDeploymentTest\dbo\Stored Procedures\LoadEmployees.sql(1,1,1,1): Build warning SQL71558: The object reference [dbo].[Employees].[HKSEmployeeId] differs only by case from the object definition [dbo].[Employees].[HKSEmployeeID]. [d:\a\1\s\DatabaseDeploymentTest\DatabaseDeploymentTest.sqlproj] 1 Warning(s) 0 Error(s) Time Elapsed 00:00:12.94


Finishing: Build solution **/*.sln



Starting: Copy Files to: $(build.artifactstagingdirectory)

******************************************************************************

Task : Copy Files Description : Copy files from source folder to target folder using match patterns (The match patterns will only match file paths, not folder paths) Version : 2.117.0

Author : Microsoft Corporation

found 0 files


Finishing: Copy Files to: $(build.artifactstagingdirectory)



Starting: Publish

******************************************************************************

Task : .NET Core Description : Build, test and publish using dotnet core command-line. Version : 1.0.2

Author : Microsoft Corporation

"C:\Program Files\dotnet\dotnet.exe" publish d:\a\1\s\DatabaseDeploymentTest.web\DatabaseDeploymentTest.web.csproj --configuration release --output d:\a\1\a\DatabaseDeploymentTest.web Microsoft (R) Build Engine version 15.1.1012.6693 Copyright (C) Microsoft Corporation. All rights reserved. DatabaseDeploymentTest.web -> d:\a\1\s\DatabaseDeploymentTest.web\bin\release\netcoreapp1.1\DatabaseDeploymentTest.web.dll


Finishing: Publish



Starting: Publish Artifact

******************************************************************************

Task : Publish Build Artifacts Description : Publish Build artifacts to the server or a file share Version : 1.120.1

Author : Microsoft Corporation


Async Command Start: Upload Artifact


Uploading 1 files File upload succeed. Upload 'd:\a\1\a' to file container: '#/677588/DatabaseDeploymentTest' Associated artifact 724 with build 835


Async Command End: Upload Artifact



Finishing: Publish Artifact


1

1 Answers

1
votes

Specify $(build.sourcesdirectory) in Source Folder and **\*.dacpac in Contents of Copy files task.