We often do a schema compare from our Dev environment into our TFS database project. Often these procedures have references to other databases (primarily the Stage DB). Every time we push our changes into TFS, we have to swap out the DB name with the SQLCmd variable.
Unfortunately, when there's 12 objects, we need to swap "DBStage" with [$(DBStage)] twelve times. It gets to be tedious. Is there an easier way?
TFS 2012
Ctrl+Shift+H - replace in all files. Search for DBStage., replace with [$(DBStage)]. Filter files to *.sql files only.
Related
I have 34 word templates in TFS and I'm suing VS2012.
Only 32 have been modified and saved under a change set.
I wanted to just extract those modified by that change set.
I made sure my mapped folder was empty before I started.
I used Advanced/Get Specific and then did a get using the changeset number
However, all 34 templates were downloaded into my folder.
The changeset get seems to get all files modified before and up to the change set I requested.
In my case I can pick out the 2 files and remove them. But if I had hundreds of files spread over a dozen folder it would be a nightmare.
Is there a way to get only those files modified by a specific changeset files ?
"Get Specific" means getting all the files as how they were at the time when ChangeSet was created. It doesn't mean getting only changed files.
Since you are using VS 2012, you could use Team Foundation Power Tools' tfpt GetCS command:
The GetCS tool retrieves all items listed in a changeset for a
given changeset version.
This is useful when a co-worker checks in a change that you need to
have in your workspace, but you cannot upgrade your entire workspace
to the latest version. Use the GetCS tool to get just the items
affected by your co-worker’s changeset. You can do this without
inspecting the changeset to manually list the changed files when using
a getcs command.
There is no graphical user interface for the GetCS tool. To invoke
the GetCS, type the following command. The parameter
changesetnum specifies the changeset number.
tfpt GetCS /changeset:changesetnum
I use excel for reporting from TFS, but one day after publishing, the structure of epics and features was destroyed and now all user stories belong to an incorrect feature, resulting in a mess. I think the problem was that I ordered the list before I publish it.
I have tried to publish all again from a correct excel file backup, but this did not work the parents are not corrected.
Any help will be very appreciated
There is no easy way to fix this. When a tree structure is sorted in Excel, all work items will be re-linked to their new parent based on their indentation.
To undo, you have a few options:
Restore the Team Foundation Server Project Collection from backup. This will revert EVERYTHING (sources, builds, tests, work items etc) to the point in time of the backup.
Restore the Team Foundation Server from backup to a new instance. Extract the original parent/child tree structure in Excel, push the correct structure to the production TFS server.
With the original Excel file, you could try copying the data from it into the current (messed up) excel file and publish that again.
Use a PowerShell or C# based automation to iterate through each work item's history (revision), find the revision that was created at the time you made the update and relink the item to the correct parent based on the historical data. See:
https://oshamrai.wordpress.com/2018/09/11/vsts-rest-api-2-get-work-items/
https://oshamrai.wordpress.com/2018/12/21/azure-devops-services-rest-api-7-add-and-edit-work-item-links/
You can use the Team Foundation Server Client Object Model to access the Work Item data stores.
Hy,
I'am trying to use Visual Studio 2012 database project to upgrade a database to a newer version but i'am having a weird problem.I select the source database then the target database and hit compare.Visual Studio generates the script with the differences and when i execute it fails because it tries to drop tables without first dropping the FK constraints that are on those tables.(normally it should first script all the constrains from a table,drop them,drop the table,after that create the new table and finally recreating the constraints)
Do you have any ideas why it tries to do directly drop table without dropping constraints first.
Am i missing some settings?
Sounds like a bug to me. Try posting the same question on the SSDT forum.
If you have access to a copy of SQL Compare, it might be worth trying the same comparison to see if this works better. If you're using a database project as a data source, you'll need to select "source control", then "scripts folder", and browse to the folder that contains the .sqlproj file. Here at Red Gate we're working on improving database project support in SQL Compare so we'd welcome any feedback or questions.
If the tables that are being dropped in your database are not in your schema definition and you have got the "DROP objects in target but not in project" option selected in the Deployment Options, then it will try to drop them.
Have you checked this is not the case?
Whenever i work with database generating code from data models, or scrips, i often get that problem, so i have an script just for deleting those keys, sometimes i have to drop my database manually rather than executing the query, because most of the times it does but not completely, so i first dro the database, generate the script and run the script just for erasing the keys
I'm using Visual Studio Team Services (previously Team Foundation Service, not Team Foundation Server) and I need to migrate a team project process template from Agile to Scrum.
Doe anyone know how to do it?
There are a couple of different ways to go about this, depending on what you want at the end. Most importantly, there is no way to change the process template from one to the other inside a Team Project, so you'll have to create a new Team Project with the Scrum Template to migrate to.
If you want history & attachments:
Then you need to use the TFS Integration Platform. You'll create a xml mapping to flow the work items and source code from one project to the other. There are quite a few issues with going this direction including, history is compressed, the tool is notoriously finicky, shared steps (and other things) don't migrate and more. This is definitely not the recommended option, but sometimes you don't have a choice. Here's where to get the tool: http://visualstudiogallery.msdn.microsoft.com/eb77e739-c98c-4e36-9ead-fa115b27fefe
If don't need history, or can keep the other Team Project around: For this method, moving the code is easy (it's even easier if you've got a Git project, and you'll get history. Use the git-tf functionality to move your source to Git). Just check out from one repository, switch your workspace mapping and check in to the new repository.
To move your work items, use work item queries and export them to Excel. Then copy/paste into a second Excel spreadsheet and upload them to the new Project. This is by far the easiest method. Here's a detailed explanation:
1) From Agile template project: for each work item type that you want to move, create a work item query to pull all the ones you want and export them all to Excel (for example a query to pull all requirements and another for tasks)
2) From the Scrum template project: create a work item query for each work item type that you want to import and export it to Excel. It's going to be blank, but you're going to use this Excel spreadsheet to upload in a minute.
3) Copy/past from one Excel spreadsheet to the other, being careful to NOT copy column headers. A neat trick is to copy the History column from the old project into the Comments field in the new project.
4) Publish the results. Viola, you're migrated.
I need to migrate Work Items from one TFS server to another TFS server. I tried migrating them using the TFSMigration tool available in CodePlex.
The problem I am encountering is the schema for the work item on the source TFS is different from the schema of the work item type on destination. I don't want the destination TFS server schema for the work item to be modified. The change in schema is one new column only, but still don't want to take that change.
In one blog it was said that we can do that using Excel but not much details were available. I am not sure we can even use Excel to migrate the entire history related to Excel.
Have a look at the TFS Integration Tools on VS gallery. This supports custom field mappings as part of a migration, documentation here (direct download).
I did this a while back and, not finding an appropriate tool, resorted to copying the title and description etc across manually, as we only had a few active work items at the time, so it only took about an hour.
however, if I need to do it again, I'll use the TFS API to read fields of interest and write them to the new database. that way any schema differences don't matter, and the process is automated but under your control. Search for studying work items with the TFS API for details - it's really very easy.
Of course with both of these approaches (and all the migration tools AFAIK) you will only get a snapshot of the data - all history will be lost (or at best you can query using AsOf to get historical data, but all the entries you make will be timestamped at the moment you write them, not with the historical time that the event originally occurred.)
You can use the Excel editor to edit the source query All Items "Open Query in Microsoft Excel". Then open the destination query All Items "Open Query in Microsoft Excel". Copy and paste the contents from one excel window to the other. Certain fields like attachments will not transfer.