TFS2018 tries to publish my Database - tfs

I have setup a Build Agent for TFS2018.
For our website project I have created a Builddefinition based on ASP.NET Website template.
During the buildprocess the agent tries to publish a database,
starting with the following steps:
GetMSDeployInstalledVersionPath: $(_DefaultMSDeployMaxVersion) is 3
$(_MSDeployVersionsToTry) is 9.0 $(MSDeployPath) is C:\Program Files
(x86)\IIS\Microsoft Web Deploy V3\ ProcessPublishDatabaseSettings:
Starting Web deployment task from source: dbFullSql(******) to
Destination: dbFullSql(******). C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Deploy\Microsoft.Web.Publishing.MSDeploy.Common.targets(55,5): Error : Web deployment task failed. (Cannot connect to the database
'XXXX'. Learn more at:
http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CANNOT_CONNECT_TO_DATABASE.)
The problem is, i do not want to publish any database and I not know why the build agent tries to publish a database.
I do not know from where he has the (wrong) information about the database.
In our solution, I do not have checked any of the deploy checkboxes for the configured configuration.
In our erlier TFS2015 Version, the build with xaml Definitions did not publish a database. I have not added something about a database in my definition. For this reason, I think, the process fin something in one of the projects about a database and think he should publish a database.
How I can remove the publishing database step?
Thank you for the suggestions.

I have the cause:
In the web project settings, you will find a package web sql pane, where the deployment of a database was configured.
To this day, I had not noticed this setting option.
I have removed and now, I can devote myself to the next deployment error :-)

Related

Team Foundation Server 2017 Build and Release

I'm trying to setup TFS 2017 in my company.
Everything is fine until I came to release tab.
I'm little bit confused.
How on earth I need to deploy everything to my local server. I read a lot of articles regarding this but still confused how to use artifacts.
Right now I have setted up source control and created build definition and stuck on release.
Anybody manage to setup release in TFS 2015 or 2017? Any help would be great!
I found this article that explains how to build and deploy web project on premise. Hope this will help somebody.
Need to use this arguments in Visual Studio Build task
/p:DeployOnBuild=True /p:DeployDefaultTarget=WebPublish
/p:WebPublishMethod=FileSystem /p:DeleteExistingFiles=True
/p:publishUrl=$(build.artifactstagingdirectory)\for-deploy\website
It will create in Artifacts folder with website that can be simply copied to remote machine in Release definition.
You should view artifacts as single deploy able packages, so if your application has a front end website and a database you can package them up the website as one artifact and the database as another during the build. When it comes to a release, your release could deploy the website to one server and the database to another or even the same server, the choice is yours. I tend to have development environments hosted on a single server but pre-production and production are load balanced, the only change from development to production is the name of the server to deploy the change to.

Issue with Database project (DACPAC) - Continuous delivery

I have Microsoft TFS build process to deploy web project to azure web role, this occurs automated way every day. I have followed Azure article https://azure.microsoft.com/en-in/documentation/articles/cloud-services-dotnet-continuous-delivery/
I have following MSBuild arguments in my build process, as above article suggested
/t:Publish /p:PublishDir=C:\MSCD\
When i add database project to my project solution, build is keep failing. Getting error message
The "SqlPublishTask" task was not given a value for the required
parameter "SqlPublishProfilePath"
When i publish my web project, i don't want database project to be published. How to drop DACPAC file to drop folder ? so i can use powershell to update my database in azure.
I am using TFS 2012 On-Premise. Could someone give suggestion on how to solve this problem?
You need to create Master-child build definitions and in master build definition configure solution with build and deploy disabled in configuration manager .and in child build configure database project alone .
Create Master and child build definition such that they share common drop .
#Siva palla's answer solved this exact same issue for me. Here are the complete set of changes we made to get this working.
Changes in Visual Studio
Originally I was using a single configuration called 'Deployment' that was set to deploy both our WinForms project and our SQL project (VisionShellWin is the WinForms project, the two Vision.SQLMigration projects are the SSDT projects) so everything below is based on changes to Deployment. For most people you'll have Release instead of Deployment, all of the below should still work fine, just substitute in Release for Deployment:
To separate that single configuration in two I created a new configuration:
I set that new deployment to copy its settings from the old Deployment configuration and not to create new configurations for each of the projects (the existing project level Deployment ones are fine):
In that new deployment I then unticked the boxes to Build and Deploy the database projects:
I then did the exact same thing again to create a Database specific deployment:
And in that one I unticked everything except the database files:
That's everything needed in Visual Studio, so I committed all of that and synced it back to DevOps.
Changes in Azure DevOps
In DevOps I cloned my existing Visual Studio Build stage (called 'Build Winforms solution') and renamed the clone to Build Databases:
I added two new build variables in the Variables tab, named ClickOnceBuildStageConfiguration and DatabasesBuildStageConfiguration with their values set to the names of the new configurations we just created in VS:
And then I changed the WinForms build stage to use the new ClickOnceBuildStageConfiguration variable - note that we still have the /T:"VisionShellWin" /target:Publish MSBuild Arguments needed for ClickOnce set:
And the new Build Databases stage to use the databases variable - note that we don't have any MSBuild Arguments:
Finally, in addition to the copy stage I already had for copying the ClickOnce application files into the drop artifact:
I also added a Copy Files stage (called 'Copy Dacpacs') to copy the DacPac into the drop too:
Once you've done all of that, you should end up with a build that works and an artifact that contains both the ClickOnce files and the DacPacs

Continous Integration with ASP.NET MVC and TFS

I have an ASP.NET MVC 3 application. This application is hosted in TFS. I have setup a build server. When a checkin happens, my code is complied and dropped in a folder on my test server. The drop folder is an IIS application folder. The goal is when a user visits http://[myTestServer]/MyProject, they should see the latest compiled version of the app. In an attempt to do this, I'm dropping files in //[myTestServer]/c$/inetpub/www/myProject/. However, I'm getting more than I bargained for.
I've noticed that the build server puts a bunch of assemblies and creates 2 directories: _PublishedWebsites and logs. _PublishedWebsites contains two directories: MyProjectName and MyProjectName_Package. From what I can tell MyProjectName contains the files that I want put in //[myTestServer]/c$/inetpub/www/myProject/. What am I doing wrong?
How do I setup it up such that when a user visits http://[myTestServer]/MyProject, they see the latest compiled version of the app?
Have a look at Microsoft's Web Deploy for deployment of Web applications and Web sites to IIS servers.
This tutorial describes in detail how to configure TFS for Web Deployment:
Configuring Team Foundation Server for Web Deployment
Creating a Team Project in TFS
Adding Content to Source Control
Configuring a TFS Build Server for Web Deployment
Creating a Build Definition That Supports Deployment
Deploying a Specific Build
Configuring Permissions for Team Build Deployment

tfspreview, continuous integration, and external folders getting overwritten

The problem stated simply:
using tfspreview.com account linked to Azure website.
using continuous deployment build provided by Azure team.
All works perfectly, when I check in:
code is uploaded to tfs server
Remote Host is used to build code
A drop folder is created with the compiled code
code from drop folder is published to Azure website
Now this is all good, but it always overwrites any external folders (not part of project) that are on the server. I went into the process template and changed 'Clean Workspace' setting to 'None', but that didn't help.
If I build locally and publish using web deploy, things don't get overwritten. What am I missing here? obviously it's something with the build process or drop folders not being aware of the publish settings. Any ideas?

How do you invoke a TFS Build from another TFS Build?

Basically, I have 2 build definitions, one builds and deploys some database projects, and the other builds and deploys a website.
What I would like to do is be able to build/deploy the databases, and if that doesn't have any errors, build and deploy the web app.
The idea being that if database deploy fails for some reason, I can restore the database from a backup and fix the issue before I deploy the web app. (Leaving the previous version of the app working)
Any info on how to invoke my database build definition, from within my web app build def would be appreciated.
Download the Community TFS Build Extensions, it contains the Queue Build custom activity which you use (or) you can call TFSBuild Commandline tool by using Invoke Process Activity.

Resources