Error with Visual Studio Pluggin

Document ID : KB000039802
Last Modified Date : 14/02/2018
Show Technical Document Details

Problem: 

When trying to check in a change to my Visual Studio project, the message appears that the context is invalid and must be reset.  Going into the "Edit Context" window, no package is selected, and the drop down selection box is disabled, so no package can be chosen.  Since the context definition is incomplete, the "OK" button is disabled and the only option available is to cancel.

Environment:  

CA Harvest SCM 12.x with Visual Studio 20xx and Visual Studio Plugin

Cause: 

When looking at the project in the Visual Studio IDE, we found that the "Checked Out" glyph appeared next to the project's solution file.  The project had just then been opened from source control and no changes to any of the files in the project had been made, so no "Checked out" glyph should have been present.  In Workbench the project's solution file showed as "N"ormal status, and not "R"eserved (checked out).  Looking more closely at the project folder in Workbench, we found that the ".cascm" folder had been checked in along with the rest of the project files.  Since the ".cascm" folder contains information needed by CA Harvest SCM to maintain the connection between the Harvest Repository and the Visual Studio project, and is meant to be temporary in nature, this folder should never be checked in along with the rest of the Visual Studio project files.  In this case, the ".cascm" folder contained some stale information about the state of the Visual Studio project, causing the Harvest repository and the Visual Studio project status to be out of synch.

Resolution:

The solution involves eliminating the ".cascm" folder and any files contained inside it from the Harvest repository.  There are 2 ways you might accomplish this:

  1. Create a new package and perform "Remove Item Path" on the ".cascm" folder, then promote the package up through all the states in the project.
  2. Demote the package containing the ".cascm" folder back through all the states to the originating state, then perform "Delete Version" on all the items in the ".cascm" folder and the folder itself.

For this particular case the choice was made to demote the .cascm folder back to the originating state and delete it.  Using Workbench and the Administrator Tool we performed the following steps:

  1. We used the "Find Version" tool to locate the package containing the ".cascm" folder. It was in the "Production" state.
  2. We checked the package history to find out all the states that this package had passed through.
  3. Since the package containing the ".cascm" folder contained other items that could not be demoted out of the "Production" state we needed to create a new package and perform the "Switch Package" process to move the ".cascm" folder and files to a separate package.  To accomplish this we created a "Create Package" process and a "Switch Package" process in the "Production" state.
  4. We created a new package in the "Production" state and used the "Switch Package" process to move the ".cascm" folder and it's files to the new package.
  5. We demoted the new package back down through all the states to the state where the ".cascm" folder had been checked in.
  6. We used "Delete Version" to delete the ".cascm" folder and files.
  7. Once the problem was corrected we deleted the new package we had created, and all the processes we created temporarily to implement the fix.

After this we refreshed the Visual Studio project on the developer's computer by deleting all the contents of the local project folder and performing "Open the solution from source control" in Visual Studio.  This time the solution file did now show the "checked out" glyph and the context could be edited as needed.