locked
TFS 2010: Unable to perform the get operation because it is writable RRS feed

  • Question

  • Hi.

    TFS 2010 SP1.

    We are getting the following error during a team build:

    Warning C:\Builds\1\Sources\Solution1\Project1\Class1.cs - Unable to perform the get operation because it is writable
    One or more errors occurred while performing a Get operation.

    The build definition uses DefaultTemplate.xml and is configured with "Clean Workspace" set to "None".

    This occurred because the previous build automatically generated Class1.cs (and was writable) and the new build was triggered from a changeset where Class1.cs is new to source control and is no longer automatically generated.

    From my research on the issue, it seemed that tfs 2008 has the ability to set ForceGet = true to resolve such issues in TFSBuild.proj.  However, it seems that tfs 2010 doesn't have this ability.

    Is this true?

    I expected the ability to set the GetOptions to Overwrite for example in DefaultTemplate.xml here:

    <mtbwa:SyncWorkspace DisplayName="Get Workspace" VersionOverride="[GetVersion]" Workspace="[Workspace]" />
    

    But the GetOptions property of SyncWorkspace (http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.client.getoption%28v=vs.100%29.aspx) seems to be different than the GetOptions property of the TFS Client API (http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.getoptions%28v=vs.100%29.aspx).

    Am I missing something?

    Is this possible in TFS 2012 or should I just go ahead and create a feature request?

    Thank you.

    Wednesday, April 17, 2013 1:22 AM

Answers

All replies

  • Hi RamiAbuGhazaleh,

    Thanks for your post!

    Please try to set "Clean Workspace" to "All" and see if it works.

    When a file is writable, and you perform to get, this error will be occur. Please check in the Class1.cs again and the queue a build and see if the build definition builds successfully.

    If it the issue exists, I recommend create a new workspace to map the solution, and perform the build.

    Please feel free to let me know if it works.

    Best Regards,


    Cathy Kong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 17, 2013 9:03 AM
    Moderator
  • Hi Cathy,

    Thank you for your reply.

    Yes, setting "Clean Workspace" to "All" works, but I was expecting not to have to manually invoke a build to fix the issue, but keep "Clean Workspace" set to "None" for performance reasons.

    I would rather not have to do this every time this type of check-in occurs; the build server should be able to resolve this issue without user interaction.

    So is there a way to have "Clean Workspace" set to "None" and set the GetOptions to Overwrite for example?

    Thank you.

    Wednesday, April 17, 2013 6:25 PM
  • Hi RamiAbuGhazaleh,

    Thanks for your feedback!

    After some research, I found you can set the GetOptions from the build workflow in TFS 2010. Please perform the following steps:

    1. In the Source Control Explorer, click the BuildProcessTemplates folder, double click the build template which you used.
    2. Locate at Process>Sequence>Run On Agent>Initialize Workspace,
    3. Right click Get Workspace and select Properties, 
    4. Locate at GetOptions, right click the ...button, and modify Microsoft.TeamFoundation.VersionControl.Client.GetOptions.None to Microsoft.TeamFoundation.VersionControl.Client.GetOptions.Overwrite.
    5. Save the build workflow, 
    6. Check the build workflow to the TFS 2010.

    For more information GetOptions, please refer to http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.getoptions(v=vs.90).aspx

    Hope it helps!

    Best Regards,


    Cathy Kong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, April 18, 2013 3:12 AM
    Moderator
  • Thank you, Cathy.

    I was confused about this because those steps change the GetOption property on the <mtbwa:SyncWorkspace /> element as I first mentioned.

    However, the documentation is misleading.

    I found the msdn documentation for SyncWorkspace.GetOptions Property here:

    http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.workflow.activities.syncworkspace.getoptions%28v=vs.100%29.aspx

    But there seems to be a discrepancy with the "GetOptions" and "GetOption" hyperlinks.

    It seems that the two "GetOption" hyperlinks should really be "GetOptions" and point to the appropriate web page.

    The "GetOption" hyperlinks currently point to

    http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.build.client.getoption%28v=vs.100%29.aspx

    Which does not have the Overwrite enum member.

    However, the "GetOptions" hyperlink seems correct and points to the link you previously posted here:

    http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.getoptions%28v=vs.100%29.aspx

    Which does have the Overwrite enum member.

    So is this a documentation error?

    If not, can you explain why there are two different types ("GetOption" and "GetOptions") in the documentation please?

    Thank you.

    Thursday, April 18, 2013 7:49 PM
  • Hi RamiAbuGhazaleh,

    Thanks for your feedback!

    I think you should use GetOptions  to overwrite existing writable files if they conflict with the downloaded files.

    For how to explain these two types, I would suggest you to report this issue on our Portal:

    http://visualstudio.uservoice.com/forums/121579-visual-studio

    This would be helpful to improve Visual Studio products.

    Best Regards,


    Cathy Kong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Friday, April 19, 2013 3:11 AM
    Moderator
  • Hi RamiAbuGhazaleh,

    I marked the reply as answer since you have not updated, if you have any concern with it, please feel free to unmark it.

    Best Regards,


    Cathy Kong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 24, 2013 9:15 AM
    Moderator