Problem installing octopus task in TFS 2017.1

Hello,

I manually installed an earlier version of Octodeploy task in TFS 2015 Update 2. It did not work.

Now I have upgraded TFS to version 2017 update 1. I try to install the latest version of the task from:
https://marketplace.visualstudio.com/items?itemName=octopusdeploy.octopus-deploy-build-release-tasks

Then I get the error:
Task definition with id 179fac12-2402-486e-80cf-5a6a8571f7c0 was installed via the tfx-cli or REST API and cannot be replaced using contribution octopusdeploy.octopus-deploy-build-release-tasks.octopus-pack. Please delete the task using the tfx-cli or REST API before replacing it with a contribution.

I have deleted the old task but I still get this error. How do I solve this problem?

Thanks
Rikard

Hi Rikard,

Thanks for getting in touch. This is a problem we’ve only seen once before, and it’s a bit tricky to resolve unfortunately.

Can you confirm that you ran the following command to delete the task, after authenticating with your local TFS server with the tfx-cli?
tfx build tasks delete -task-id 179fac12-2402-486e-80cf-5a6a8571f7c0

If so, the next step is to gather a bit of info on the task itself and where it’s being stored.

Can you run these queries on both the config and collection databases for your TFS instance?
SELECT * FROM Task.tbl_TaskDefinition where TaskId = '179FAC12-2402-486E-80CF-5A6A8571F7C0'

SELECT * FROM Task.tbl_TaskDefinition where TaskId = '4E131B60-5532-4362-95B6-7C67D9841B4F'

And let us know which of the databases returns results if any?

The suspicion last time this occurred was that the tfx-cli was pointing to the incorrect DB while deleting the task, so we want to make sure we know where the task lives.

Thanks,
Damian

Yes, That was the command I was running.
tfx build tasks delete -task-id 179fac12-2402-486e-80cf-5a6a8571f7c0

The first SELECT:
SELECT * FROM Task.tbl_TaskDefinition where TaskId = ‘179FAC12-2402-486E-80CF-5A6A8571F7C0’

returns one row:
1, 8, 179FAC12-2402-486E-80CF-5A6A8571F7C0, OctopusPack, Package Application, 0, 0, 0, NULL, NULL, 1

Thank you
Rikard

Hi Rikard,

Thanks for doing that. Can I check - did you run that query over the configuration database or the collection database?

Thanks,
Damian

Hi Damian,

I run this query over the collection database.

Thank you,
Rikard

Hi Rikard,

Thanks for that. One final thing, what was the URL you used to connect to TFS from the TFS-CLI tool?

Thanks,
Damian

Hi Damian,

I used this command:

tfx login --auth-type basic

Then answered the questions like this:

TFS Cross Platform Command Line Interface v0.3.43
Copyright Microsoft Corporation
Service URL: http://tfsserver:8080/tfs/NxCollection
Username: nx/tfsservice
Password:

And finally I used this command:

tfx build tasks delete

TFS Cross Platform Command Line Interface v0.3.43
Copyright Microsoft Corporation
Task ID: 179fac12-2402-486e-80cf-5a6a8571f7c0

Thank you,
Rikard

Hi Rikard,

Thanks for your patience here.

Are you able to use Fiddler to do a trace while you both get the task details (tfx build tasks list), and when you try to delete it (tfx build tasks delete)?

Thanks,
Damian

Hi

Sorry for late reply.
The solution to this was to go back to TFS 2015 and remove the Octodeploy task in TFS 2015, and then do the upgrade again to TFS 2017 and install the Octodeploy task again in TFS 2017.
Now it is working.

Rikard

Hi Rikard,

Thanks for taking the time to get back to us and let us know about the fix. Sorry to hear it involved that much work. One can only dream that one day MS will make TFS a much easier to troubleshoot tool :frowning:

Dalmiro

Hi Damian and other Octopus Support people. Bit late to the game for this one but I too have found this exact same issue, Was just doing an upgrade from 2.0.44 to 2.0.78 in Prod and though to check our Staging environment but found I had a really old version in staging that I must have installed using TFX-CLI when the DB was TFS 2015, now its 2017.2 but still had a remnant of the old Octopus 0.3.0 (don’t know if that is your version, or a version I created)

id : 4e131b60-5532-4362-95b6-7c67d9841b4f
name : OctopusCreateRelease
friendly name : Create Octopus Release
visibility : Build,Release
description : Create a Release in Octopus Deploy
version : 0.3.0

I did a SELECT * FROM Task.tbl_TaskDefinition where TaskId = ‘4E131B60-5532-4362-95B6-7C67D9841B4F’ from the Config DB, I deleted it, maybe I shouldn’t have but there still seems to be more to remove, do you know what else I need to remove in the DB to clear it out so I can install the latest vsix package?

NOTE - The latest TFX-CLI doesn’t delete the Build Task, says it was successful but when you run a list again, it still there.

Hi Simon,

So that we can help you troubleshoot, would you please be able to get some more information for us?
The VSIX package includes 5 commands, you may have to delete all of them before upgrading:

D05AD9A2-5D9E-4A1C-A887-14034334D6F2    OctopusPush    Push Package(s) to Octopus
1627FCFE-F292-4904-ADAC-26CFB14BDB07    OctopusPromote    Promote Octopus Release
179FAC12-2402-486E-80CF-5A6A8571F7C0    OctopusPack    Package Application
4E131B60-5532-4362-95B6-7C67D9841B4F    OctopusCreateRelease    Create Octopus Release
8CA1D96A-151D-44B7-BC4F-9251E2EA6971    OctopusDeployRelease    Deploy Octopus Release

Each of the tasks also has a FilePath that points to a zip file, you may need to ensure that this is removed after issuing the delete command. I would suggest just moving the files to be on the safe side.

After deleting each of the tasks out of the database, and confirming through the task list command, please post back any upgrade error messages you continue to receive.

Regards
Ben

Fixed - The version we have on our TFS staging environment predated the vsix package, Its the 0.3.0 version that only has 4E131B60-5532-4362-95B6-7C67D9841B4F Create Octopus Release in the config db, I deleted it from the config database but I still couldn’t install the new vsix package. Turns out all I needed to do was to restart the AppTier, the website must have been caching parts of the config db, Not to sure how it works under the hood but a restart fixed it.