0

I'm hoping you can help me solve this development workflow annoyance.

I'm a front-end dev working on a project where most of the other developers use MS Visual Studio, and I don't. We've got TFS set up, and I'm able to check out code and make edits locally.

After making edits, I check in my code to a local Git repo via git add and git commit, then push to TFS via git tf checkin.

The Problem is that our developers using Visual Studio aren't able to see the files I've added after updating their workspaces from TFS. We've tracked down the cause of this issue to the .csproj files—any files I add to the repo (e.g. JavaScript, CSS) have to be manually added to the project in Visual Studio, because my workflow doesn't use VS and doesn't update the .csproj file.

  • Has anyone faced a similar situation and found a solution?
  • Is there maybe a tool that can notice added files and update the .csproj file to match?
  • Maybe there's a setting in Visual Studio so that it notices new files in its directories and adds them to the project automatically?

Thanks in advance for any suggestions.

Alex W
  • 719
  • 7
  • 14

1 Answers1

2

There are many possible solutions. A .csproj file is written in MSBuild XML dialect, and it has lot of power: there is a whole book that explain all the nuances.

Solution 1

You edit manually the .csproj file, adding the new files.

Solution 2

As above, but you leverage wildcards for file names, e.g.

<Content Include="Images\orderedList*.png" />

Solution 3

Include a separate .proj file so it is clear what is managed by you. In the main .csproj add

  <Import Project="Felix.proj" />

than create your separate Felix.proj

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Content Include="Images\orderedList*.png" />
</Project>

and we may go on, but this could be a starting point.

Solution 4

A different route is to change your workflow: commit via Visual Studio instead of the command line. Here is a how:

  • Install Visual Studio (at least 2013 Update 4, Community Edition should be ok)
  • edit / add files the way you like
  • Open the .csproj using Visual Studio
  • In the Solution Explorer panel select the Show all files option
  • Right-click on the missing file/folders, and select Include in Project
  • save the changes
  • switch to the Team Explorer tab, you should see the red buttons of Git operations
  • select Changes and do your commit
  • back to command line for git tf

YMMV

Solution 5

Write you own tool that parse git status, append the added files to the .csproj and add this latter to the stage. A script can make it.

Giulio Vian
  • 8,248
  • 2
  • 33
  • 41
  • This is a great starting point, thanks for your suggestions. Unfortunately these both result in me still having to manually edit the file… any ideas about how I could automate this process? Maybe something tied in with Git `add` statements? – Alex W May 23 '15 at 00:29