2

Is it possible to force the user to get latest of a file before reading from it?

An example would be for our custom Code Analysis rule set (.ruleset). I do not want someone to run Code Analysis on an old version of the rule set.

We are using Visual Studio Online and Visual Studio 2013 and Team Foundation Version Control.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
Dave New
  • 38,496
  • 59
  • 215
  • 394

1 Answers1

2

There is no option in Visual Studio for this, and it doesn't really make sense to always want to enforce this for all files in a workspace, sometimes you need to build against an older version of the code. That said, you could add a pre-build action that uses the TFS commandline to get the latest version of these specific files, something like:

>TF get $/Project/CodeAnalysisRules/MyProject.Ruleset /version:T

You might need to disable the UseHostCompilerIfAvailable flag in your project file, as it might otherwise not detect the changed file till after the build has completed.

Community
  • 1
  • 1
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • 2
    I think a better approach would be leaving the Code Analysis checks to the automatic CI build. – KMoraz Mar 02 '14 at 21:14
  • Agreed, Using a CI build would be ideal, though if you build a specific Changeset or Label it will still not use the latest version of the `.ruleset` file. If Build is not available, this is the "next best thing" if you have such a requirement. – jessehouwing Mar 03 '14 at 17:00