Build Failing - Missing Visual studio 2017 data tool - build

I am getting below error while building my project. It seems I am missing data tool components on my build agent
No agent found in pool Hosted VS2017 which satisfies the specified
demands: sqlpackage Agent.Version -gtVersion 1.103.0
But I am unable to get offline installer for data tools for VS 2017. Please help.

The sqlpackage.exe is existing on Hosted VS 2017 agent, but not in the capacity list. (can’t add this capacity manually and use deploy database task, check VS2017 Hosted Agent: SQL Server Data Tools)
The workaround is that you can call sqlpackage.exe command by using Command Line task:
Right click your project > Publish to create a publish profile
Edit that publish profile to add Password to TargetConnectionString (Could be tokenized by using Replace Tokens task)
Sample:
<TargetConnectionString>Data Source=XXX.database.windows.net,1433;Persist Security Info=True;User ID=XXX;Password=XXX;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=True</TargetConnectionString>
Check in changes
Add Command line task: (Tool: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130\sqlpackage.exe; Arguments: /Action:Publish /SourceFile:"$(build.artifactstagingdirectory)\DatabaseDemo.dacpac" /Profile:"$(build.sourcesdirectory)\DatabaseDemo\DatabaseDemo.publish.xml")
Queue build with Hosted VS2017 agent.

Related

The nuget command failed with exit code(1) The element <ProductVersion> beneath element <Project> is unrecognized

I'm setting a build in Azure DevOps Pipelines, I have in repos some solutions including a SQL Server Analysis Project. This project triggers a error in the build for the NuGetCommand:
[error]The nuget command failed with exit code(1) ...: error MSB4067: The element <ProductVersion> beneath element <Project> is unrecognized.)
[error]Packages failed to restore
[section]Finishing: NuGetCommand
Any ideas how to solve this error? Maybe run the NuGetCommand for all projects except this SSAS, how can I exclude this solution/project?
I tried to Manage NuGet Packages for this SQL Server Analysis Project, but is not supported.
I have this code in the azure pipeline, I need to run this command for every solutions except SQL Server Analysis Project.
- task: NuGetCommand#2
inputs:
restoreSolution: '$(solution)'
The nuget command failed with exit code(1) The element beneath element is unrecognized
This issue is more related to the MSBuild instead of nuget.
Since NuGet is now fully integrated into MSBuild, when we invoke nuget to restore packages, it will call MSBuild auto-detection. There is a issue in MSBuild 15 about it.
Besides,
the latest version of Microsoft Reporting Services Projects for Visual
Studio (1.18) adds MSBuild support for SSRS projects. With this
installed, SSRS projects can be updated to a format supported by
MSBuild, which prevents this problem from happening.
So, to resolve this issue, please update your Visual Studio on the agent server to the latest version to check if you still have this issue.
Hope this helps.

I cannot connect to azure devops artifacts - nuget feed

I cannot connect to my nuget feed by visual studio 2017 enterprise. I'm owner of nuget feed. When I use browser in VS i can connect but when i use nuget source i get 401 unauthorized exception.
enter image description here
Does your organization connect to AAD? Do you use a Work account or Microsoft account?
If your organization doesn’t connect to AAD, and you use a work account, you’ll meet this error. If you use a MSA account, you’ll find you can restore the packages without issue.
It’s a known issue, and has been fixed in VS 2019 Preview2 (I have verified it’s working in VS2019 Preview2). Currently, the workaround for previous versions of VS is generating a PAT and register the Nuget feed on your system with following command. I’ve tested in VS2017, after running the command below, I can restore the package with a work account:
nuget.exe sources Add -Name "FeedName" -Source "https://feedurl" -username unused -password PAT

Visual Studio Team Services Build cannot deploy test agent

I've got a VSTS build that is trying to deploy a test agent so I can run some Selenium tests and when I get to the "Deploy TestAgent on" build step, I am getting the following error:
2017-06-22T14:29:05.6157972Z ##[warning]Task 'DownloadTestAgent' for
machine vmtest43xxx.cloudapp.net:5986's Error : System.Exception: The
process cannot access the file 'C:\TestAgent\vstf_testagent.exe'
because it is being used by another process.
Also, if setting up a local build agent is a good workaround for this, I'm all ears, but so far I have had a lot of trouble trying to set up a local test agent. This seems weird since setting up a local build agent was relatively easy up to this point. Any suggestions on how I should set up a local agent? I've been trying to follow instructions from here and here.
Thanks!
It’s easy to setup a local build agent, so try to setup a build agent:
Steps for windows:
Go to Admin page of Agent Pools (https://[account].visualstudio.com/_admin/_AgentPool)
Click Download agent button
Unzip the downloaded file
Run Command Line as Administrator
Run config.cmd
Specify collection url (https://[account].visualstudio.com), Personal Access Token etc
More information, you can refer to: Deploy an agent on Windows.
You can specify Test Agent Location (can be access from build agent machine) for Visual Studio Test Agent Deployment task to save time.

Configure local build server to work with a Visual Studio Online account

Is it possible to use a local build server for a Visual Studio Online account so that with a gated check-in policy, check-ins are only committed when the build server builds successfully? I don't have expertise in this space, so ideally I'm looking for steps to do the setup.
Yes, you can do what you are asking. Simply install TFS Build Server and when you are configuring it give it the URL for your VSO Collection.

Team Foundation Server Deployment error

I have setup my own Team Foundation Build server and I am using Visual Studio Online to host my project online. I have a django project which I am trying to deploy on windows azure cloud service. The project can be published from my dev machine without any errors however when the build server tries to build it, it gives the following error during uploading the package:
Exception Message: Could not load file or assembly 'Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (type FileNotFoundException)
I checked in .pyproj and found a reference to Microsoft.WindowsAzure.Storage but there the version is 2.1.0.0 and that is the version that is installed on the server as well.
Also there are no errors during the build process but only during the deployment stage. How do I make Msbuild use Storage version 2.1.0.0 instead of 2.0.0.0 . Also, which SDK version contains Storage version 2.0.0.0
I just had this problem. This is the same problem as TFS Build Controller : "Could not load file or assembly 'Microsoft.WindowsAzure.StorageClient, Version=1.7.0.0".
You'll need to copy Microsoft.WindowsAzure.Storage.dll version 2.0.0.0 to "C:\Program Files\Microsoft Team Foundation Server 12.0\Tools", and then restart the Visual Studio Team Foundation Build Service Host 2013 service.