Azure devops failing to build visual studio sql database project: SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found - visual-studio

I have a sql database project in Visual Studio (2019).
I am trying to deploy it via azure devops.
The pipeline is failing due to the below error:
##[error]C:\azagent\A1_work\r1\a_Transcripts-SQLDeployment\SampleDatabaseProject\SampleDatabaseProject\SampleDatabaseProject.sqlproj(117,3): Error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\SSDT\Microsoft.Data.Tools.Schema.SqlTasks.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk
The project builds without issue on my pc.
In the pipeline I have tried both the MSBuild and Visual Studio Build tasks, but the result is the same in each case.
Steps tried:
I found the reference in the sqlproj file xml, and removed it but this did not resolve the issue.
Appreciate any expertise on how to resolve this.

Related

MSB4019 VSTO targets not found TeamCity build agent

I'm using a TeamCity build server to try and build an Outlook Addin, I can build & test the code using TeamCity, but when it comes to publishing the app to a folder I get the following error.
Obviously the build server is missing some SDK components to complete the package\publish step.
Does anyone know which Windows SDK I need to get installed on the build server?
Nothing to do. None of the projects specified contain packages to restore.
XXXXXXXX.Outlook.csproj(331,3): error MSB4019:
The imported project "C:\Program Files\dotnet\sdk\7.0.102\Microsoft\VisualStudio\v17.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" was not found.
Confirm that the expression in the Import declaration "C:\Program Files\dotnet\sdk\7.0.102\Microsoft\VisualStudio\v17.0\OfficeTools\Microsoft.VisualStudio.Tools.Office.targets" is correct, and that the file exists on disk.
Build FAILED.

Error while building SSIS project using MSBuild during CI/CD implementation

Can someone assist with the following error which i am getting while building SSIS project using msbuild. I am having Visual studio 2015 in the machine. Using MSBuild 14.0
"*
error MSB4041: Th e default XML namespace of the project must be the
MSBuild XML namespace. If the project is authored in the MSBuild 200 3
format, please add
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the
element. If the proje ct has been authored in the old 1.0 or
1.2 format, please convert it to MSBuild 2003 format.
*"
I have gone through some articles online but couldn't find solution with this scenario.
*" I have gone through some articles online but couldn't find solution with this scenario.
I'm afraid the answer is negative. For now this scenario(build SSIS project using msbuild) is not supported.
Someone has post this issue in DC forum, see Support SSIS, SSRS, SSAS in MSBuild. So if you're trying to use azure devops for CI/CD process, please vote and track this issue to get notifications when there's any update. And if you're using other tools for CI/CD process, I suggest you open a new feature request to support SSIS building for stand-alone msbuild tools in local machine.
And here're two workarounds which may help:
1.Since you have VS2015 installed, instead of msbuild command, you can try using devenv command.
For VS2015, we can find devenv.exe and devenv.com in path C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE. Both devenv.exe and devenv.com works for this, but note: Using devenv.exe directly prevents output from appearing on the console.
So devenv.xxx ... xxx.dtproj /build can work to build the SSIS project.
2.We can find binary(Microsoft.SqlServer.IntegrationServices.Build.dll) of the SQL Server Data Tools in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE. Then we can use msbuild UsingTask element to call the tasks defined in that assembly.
The core is to call DeploymentFileCompilerTask task for SSIS build in our custom msbuild target after defining this statement:
<UsingTask TaskName="DeploymentFileCompilerTask" AssemblyFile="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.SqlServer.IntegrationServices.Build.dll" />
More details please refer to here and here.
Update:
If we have several Database projects and SSIS projects in same solution. Using command like devenv.com xx.dtproj directly will actually build all projects.
So I suggest we use command in this way:
Open Developer command prompt for VS
cd to solution directory
use command: devenv.com SolutionName.sln /Build Development /Project SolutionName\xxx.dtproj /ProjectConfig Development
This will only build the SSIS project actually.
In addition: If you see the message The project 'DatabaseProjectName.sqlproj' will close once model building has paused. If it doesn't affect your build, just ignore it. After my check if won't actually build Database project(the output of database project is empty) if we use command above.

Azure Devops build fails Warning MSB3245: Could not resolve this reference

I'm trying to create a pipeline in Azure DevOps and I get compilation errors caused by a missing reference:
[warning]C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5):
Warning MSB3245: Could not resolve this reference. Could not locate
the assembly "ABC". Check to make sure the assembly exists on disk. If
this reference is required by your code, you may get compilation
errors.
I have a VS2017 solution with 2 projects.
ABC which is the actual application
ABC.UnitTests where I added some unit tests (I'm using MSTest)
When I build the solution locally, I'm able to do a successful build with the following steps:
Build ABC project => ABC.dll is generated
Add reference in ABC.UnitTests proj to ABC.dll
Build the entire solution => build successful
The .cs file in ABC.UnitTests references the application in this way, and generates the warning above:
using ABC;
If I do a clean build where ABC.dll is deleted and then I do a build of the entire solution I get the same MSB3245 warning. So the issue is reproducible locally if the dll does not exist.
Then, when I upload the solution to Azure DevOps, I do the following steps.
Upload the solution from local VS2017 and a project is created in Azure
Build the project in Azure DevOps => reference issue reported
I have a YAML config file with name azure-pipelines.yml which references the hosted 2017 agent.
pool: vmImage: 'vs2017-win2016'
Alternate flow:
Upload the solution from local VS2017 and a project is created in Azure
Comment out the reference to ABC.UnitTests project from the sln file
Create the pipeline => build successful.
You shouldn't refer any DLL as you mentioned in the comment.
The proper way is to refer to as a project. This way the DLL takes care of itself during the build
Proper way is
References -> (Right Click) Add References -> From that using Projects tab you can choose the Project which is generating that DLL(assemblies)
You can refer this SO

Build SSIS project with Visual Studio 2013

I have to automate the way we build and deploy our SSIS projects.
We use VS2013, SQLSERVER2014 and TFS2015. I'm already aware of two solutions:
1) MSBuild: I followed this blog https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/ and it works fine for VS2010 but unfortunately not for VS2013.
The error I'm getting is:
Project "SSISTest\SSISTest\SSIS.MSBuild.proj" on node 1 (SSISBuild target(s)).
SSISBuild:**************Building SSIS project: ..\SSISTest\SSISTest.dtproj for onfiguration: Development**************
------
Loading project file '..\SSISTest\SSISTest.dtproj'
Setting output directory to '..\SSISTest\bin\Development'
Setting project ProtectionLevel to 'DontSaveSensitive'
Loading package '..\SSISTest\Package.dtsx'
error : Error while loading package '..\SSISTest\Package.dtsx': The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.\r
error :
error : The package failed to load due to error 0xC0011008 "Error loading from XML. No further detailed error information can be specified for this problem because no Events object was passed where detailed error information can be stored.". This occurs when CPackage::LoadFromXML fails.\r
error : \r
error : at Microsoft.SqlServer.Dts.Runtime.Package.LoadFromXML(String packageXml, IDTSEvents events)\r
error : at Microsoft.SqlServer.IntegrationServices.Build.DeploymentFileCompilerTask.LoadPackage(String path)\r
error : at Microsoft.SqlServer.IntegrationServices.Build.DeploymentFileCompilerTask.Execute()
Done Building Project "SSISTest\SSISTest\SSIS.MSBuild.proj" (SSISBuild target(s)) -- FAILED.
2) devenv: works fine but our projects are all protected with a password, and everytime you try to build it prompts the dialog to insert the password.
Is there any other way I can automate this in VS2013?
I'll answer myself. After adding the proper dll references (expecially the Microsoft.SqlServer.ManageDTS one) for VS2013 to the http://sqlsrvintegrationsrv.codeplex.com/SourceControl/latest project, generating the .dll allowing MSBuild to build SSIS project as suggested by https://speaksql.wordpress.com/2013/06/07/a-journey-to-db-deployment-automaton-ssis-build-using-msbuild/, worked just fine. I'm now able to automatically build SSIS projects with MSBuild and deploy them to a SQL Server 2014 instance.

TFS Build Server failing

Here at my new work, we are forced to use Microsoft Team Foundation Server 2008, for our builds.
Even most of developers already moved to VS 2010, and 2012, but the build server is still TFS 2008.
Any way, I am working with VS 2010 project, and I built the "default build definition", on 2008 TFS server.
The build is failing.
Looking at the log, it is trying to delete the workspace "agentserver_104_" but didn't find it, but then later try to create the workspace "agentserver_104_". but it fails because there is already a workspace called "agentserver_104".
This is the error message with the log
Target "CoreInitializeWorkspace" in file "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets"
Using "DeleteWorkspaceTask" task from assembly "c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll".
Task "DeleteWorkspaceTask"
DeleteWorkspaceTask TeamFoundationServerUrl="http://xxxxx:8080/" BuildUri="vstfs:///Build/Build/21924" Name="agentserver_104_" DeleteLocalItems=True
TF14061: The workspace agentserver_104_;TCPL\TFSBuild does not exist.
Done executing task "DeleteWorkspaceTask".
Task "DeleteWorkspaceTask" skipped, due to false condition;
Using "CreateWorkspaceTask" task from assembly "c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.Tasks.VersionControl.dll".
Task "CreateWorkspaceTask"
CreateWorkspaceTask TeamFoundationServerUrl="http://xxxxx:8080/" BuildUri="vstfs:///Build/Build/21924" Name="agentserver_104_"
BuildDirectory="E:\TFSBuild\Geofind Modernization\GeoFacility 10.1 - Win7" SourcesDirectory="E:\TFSBuild\Geofind Modernization\GeoFacility 10.1 - Win7\Sources" Comment="Workspace created by Team Build"
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(801,5,801,5): error : The path E:\TFSBuild\Geofind Modernization\GeoFacility 10.1 - Win7\Sources is already mapped in workspace agentserver_104.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(801,5): error MSB4018: The "CreateWorkspaceTask" task failed unexpectedly.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets(801,5): error MSB4018: Microsoft.TeamFoundation.VersionControl.Client.MappingConflictException: The path E:\TFSBuild\Geofind Modernization\GeoFacility 10.1 - Win7\Sources is already mapped in workspace DAPP03085_104.
Notice that when it tried to delete the workspace, it uses the name agentserver_104_
But the existing name was : agentserver_104
Without the trailing underbar.
any idea?
There seems to be a problem with probably referenced projects i suppose. Because the real error is The path E:\TFSBuild\Geofind Modernization\GeoFacility 10.1 - Win7\Sources is already mapped in workspace DAPP03085_104. So I think you need to check that one.

Resources