19

I have a script that generates a .sln file and a few .vcproj files for visual studio 2005. I need to set the WorkingDirectory option but its specified in the .user file. A file we cannot currently generate. I found the vcproj file definition at msdn, but it seems that this option cant be set from there.

How does one specify "Configuration Properties->Debugging->Working Directory" from the .sln or .vcproj file?

Richard J. Ross III
  • 55,009
  • 24
  • 135
  • 201
Mizipzor
  • 51,151
  • 22
  • 97
  • 138
  • 2
    I think it is ridiculous that there is no simple solution yet to this problem. You are not supposed to commit your .user files to a VCS either, so this problem scales to non-generated solutions. – levesque Feb 25 '10 at 19:55
  • 2
    We fell back to using a *please-run-me-after-checkout* script. But like Alan BcBee's answer, it feels overly hacky. It makes the perfectionist in me a bit sad every time I see the file. Still hunting for a decent solution. :) – Mizipzor Feb 26 '10 at 09:11
  • See [change the working directory through VC++ property sheet](https://stackoverflow.com/a/43825112/12447766). – Burak Oct 24 '22 at 07:34

2 Answers2

8

After you change your settings, and close the sln you will get a user file named something like:

Project_Name.vcproj.Domain.user_name.user

Change it to: Project_Name.vcproj.user and commit.

The next person who checks out the code will use this user file to create their user specific one.

Ujjwal Singh
  • 4,908
  • 4
  • 37
  • 54
ScottyR
  • 96
  • 1
  • 1
3

Change from my comment. I did find the property:

VCDebugSettings.WorkingDirectory

Use Visual Studio Extensibility to create an add-in or macro that calls this method. You should be able to hook into a BeforeCompile event or something to set it.

Not an easy answer, but doable.

Alan McBee
  • 4,202
  • 3
  • 33
  • 38