Welcome to McFunley.com Sign in | Join | Faq

Reference Editor Utility for Visual Studio 2003 Projects

posted on Saturday, June 18, 2005 8:31 AM by mcfunley

I have created a sourceforge project for a utility I wrote, refed. This is a command-line utility that can edit assembly file references in bulk. This might be useful to you if you are managing a very large, rapidly changing solution with a lot of projects (as I am).

 

This program is primarily written in C#, although there is a C++ library used to resolve references to the GAC. The license is BSD.

 

Here are some of the features:

  • Ability to add and remove file references in bulk.
  • Ability to exchange one referenced assembly with another.
  • Ability to add a reference to projects where another specific reference is found.

Here is the full help text:

 

REFED Version 1.0.0.1 by Dan McKinley

 

Adds and removes references from VB.NET and C# project files.

 

Usage: refed [options] [-p projects]

 

--------------------------------------------------------------------------------

 

Options:

 

  -a[dd] assembly(*)    |    Add a reference to the specified assembly to all

                        |    projects.

  -e[xchange] a1 a2(*)  |    Swaps references to assembly a1 with references

                        |    to assembly a2.

  -f[ile] filename      |    Specifies a file containing commands to process

                        |    (**).

  -h[elp]               |    Display this usage information.

  -l[ib] path           |    Uses a relative or absolute library path when

                        |    resolving assemblies.

  -[lis]t               |    Lists the references found in each matching

                        |    project.

  -r[emove] assembly    |    Remove the reference to the specified assembly

                        |    from all projects.

  -s                    |    Recurse subdirectories.

  -q[uiet]              |    Display no output.

  -v[erbose]            |    Show verbose output.

  -w[here] a1 a2(*)     |    Add a reference to a2 where references to a1 are

                        |    found.

 

If you specify project files, do so after all other options. If you omit the

project files, by default all *.vbproj *.csproj files are handled.

 

(*) Added assemblies will be resolved from the current directory, then the

lib directories (if any are specified), then the Global Assembly Cache. When

specifying an assembly in the GAC, you may enclose the name in quotes and

provide a full or partial assembly name. When referencing files, the .dll

extension is assumed.

 

(**) The command file can be multiline. Use '#' at the beginning of lines to

denote comments.

 

--------------------------------------------------------------------------------

 

Examples:

 

   refed -add System -s

 

       Adds a reference to the System assembly to all C# and VB.NET projects

       in all subdirectories.

 

   refed -exchange CommandBar "CommandBar, Version=2.1.0.0" -s

 

       Makes sure that the reference to the CommandBar assembly is using the

       version specified (from the GAC).

 

   refed -r System.Xml -a myxml -lib c:\binaries -p myproj.vbproj

 

       Adds a reference to myxml, and drops references to System.Xml.

       C:\binaries will be searched for myxml.

 

My immediate goals for the project are to:

  • Add some searching options (as parameters to the “-list” option).
  • Add an “-analyze” option. What I would like here is a printout of where dependencies of references are not referenced. Visual Studio will not complain about this, but it can wreak havoc if you are using a more stringent tool (such as nant) to do your deployed builds.
  • Write some nant tasks that use refed.

Now, I am not sure if this thing is going to be useful or not in the MSBuild/VS2005 world. I am adopting a wait-and-see attitude on that. But hopefully somebody will find a use for it in the meantime.

Comments

SKIN NAME : ImageHeader