Three Is It

Because two isn't enough and four is just too many

A tyrant has succeeded in his search for absolute power when his own people fear to question his actions.
Ramman Kenoun
Home Blogs Genealogy Brad's Bookshelf Subscriptions Contact Sign in
 

About the author

Brad Butts is a .NET developer and architect. He is married with children and enjoys reading, working out, and genealogy is his five minutes of spare time.
E-mail me Send mail
National Debt Clock

Recent comments

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Use the User File to Resolve Reference Problems

I always forget this quick fix, so I just want to dump it out here before I forget again.

On occasion, I'll need to work on a solution authored by one of my co-workers.  Many times, even though I've installed the same third party dependencies as my teammates, the filepaths won't line up quite right and I'll have broken references in a given project.  I could check the CSPROJ file out and change the references to my liking, but then I'll break my teammate--and that wouldn't be nice.  Instead, I'll take advantage of the CSPROJ.USER file--a local file that Visual Studio will either create for me under certain conditions or one I can create myself.  

Generally speaking, each project under a given solution can have one .USER file.  The file should remain local to your machine (don't check it in to source control), but Visual Studio will use it as a compliment to the CSPROJ file it helps describe.  In this instance, I will use it to help resolve some reference paths:

So, here's my problem: 



To fix this, I created a .USER file next to my CSPROJ file.  If my CSPROJ file were named Bunnies.csproj, I would create a blank text file called Bunnies.csproj.user.  To fix my references, I added this xml (MSBuild markup) to my .USER file:



Notice that you can add multiple paths so long as they're delimited by a semi-colon.  This is helpful if your broken references are lying all around your hard drive.  Also notice the I've ended each path with a final back slash.  I've found that reference paths only work when you include this last character at the end of each path.  And, tada, my broken references have been magically fixed:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:
Categories: Technology Blog
Posted by Brad on Wednesday, June 25, 2008 10:47 AM
Permalink | Comments (0) | Post RSSRSS comment feed

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

Thursday, November 20, 2008 7:06 PM