adding reference of separated project to more than 50 projects - Visual Studio 2010 - visual-studio-2010

We had to separate a class library from core library project. And now, we should add the reference of the new project to the other 50 or something projects in a solution, which is ASP.NET MVC solution if it matters. Is there any way to automate this addition of reference? I have resharper but I can't find such a functionality with it.

VSCommands 2010 enables you to copy and paste references (as well as several other very useful features). Not quite automated, but much less painful than having to open each project's references and navigating to add ref.

Another way would be to do some sort of search and replace in csproj files using NotePad++ or some other text editor.
You can also take a look at the Powershell console (I think its part of Nuget) and modify your proj files with powershell commands. Take a look here (deals with manipulating references): how to find reference path via *.csproject file

Related

Create Visual Studio Solution From msbuild .proj file

Does anyone know if is possible to have a Visual Studio project created automatically from a msbuild .proj file?
Thanks
I've just been trying to do something similar. Basically VS2010 won't let me add a "*.proj" file to a solution. HOWEVER, I found that if I simply renamed it to be a vbproj or a csproj, then VS2010 would let me add it to a solution, and it seemed to invoke it correctly. (The vbproj seemed 'nicest' to me, in that it didn't have a redundant "References" sub-folder.)
It does seem odd that VS2010 seems unable to work with an ad hoc MSBuild project file, demanding instead one that is tied explicitly to a specific languade (C#, VB.Net, SQL, WiX, ...)
In my case, it simlpy had an Exec task in it to go and invoke Doxygen to build developer documentation. That is, it was pretty simple! I hope the same trick might work for you too!
Another option might be for you would be too look at the "Makefile" project type in VS2010 (its under C++); that would allow you to directly invoke nmake and do away with the proj wrapper completely.

Find references Visual Studio 2010

I have a massive Visual Studio Solution with many many projects contained within.
The solution uses the SparkView engine and I need to update the reference to a more modern version.
I went through and updated the reference, however something somewhere is still targeting the old dll. It appears in the object browser twice as version 1.1(old) and 1.6(new).
Is there any where to find out all the places a dll is referenced?
I found a neat plugin on the gallery called "Assembly Version Manager" visualstudiogallery.msdn.microsoft.com/… which allowed me to track down all the references
Just off the top of my head why not do a 'find in files' text search with a text editor to search the text source files for the old reference?

What type of extension for VS (and how) to make, to generate C# or C++ code from some text [more so a model]?

I am new to Visual Studio Extensibility and want to make an addin/extension which shall do the following:
It should read all the files with a specific file extension (assume "*.ump").
It should process the text/code/whatever in the files.
It should create new Class/Code file with some code in it. [The code will be produced in step 2, just need to know how to do it?]
Yet, I have been racking my brains through extensibility, saw the single file generators .... and addins which go through ProjectItems and can detect the file extension,
BUT I HAVE NOT BEEN ABLE TO FIND a complete tutorial, guide or explanation as to how or what to do!!
Please help...
You don't want to read all files with a specific file extension in Visual C++ project nor standard Visual C# project. You may do that with hand-made MSBuild project (included in the solution).
In Visual C++ projects, there is a way to define custom tools. They are run as separate processes, so you can implement them in anything you want. Studio will ask you whether you want to define a tool (they are defined in special xml files; studio has dialog for editing them) when you add a file with extension unknown to it. In Visual C# projects, just manually write a MSBuild tasks and insert them into the project.
Do whatever you want. IIRC the generated files will have to be included in the project though. Well, for MSBuild, just tweak the project to your heart's desire, but in Visual C++ they have to.
You can combine MSBuild (csproj,vbproj) and VisualC++ projects in a single solution, so I recommend using separate.
If you ever find out you need to compile for different target where you can't use Visual Studio, you'll be glad that you have stand-alone tool you were just calling from Studio and not something that embeds in it.

Visual Studio 2010 - Add Reference Tabs will only give me projects. No Browse Allowed?

My problem seems pretty simple. I have a Solution with multiple projects and basically I am trying to do some mixing with C++, C# and CLI. My problem is that I need to add references from my c++ project. When the "Add Reference" dialog comes up, I only get tab for "Projects".
I know that usually you get multiple tabs for adding different reference types. What I am interested in is the "Browse" dialog. I need this to add a reference to a dll that is prebuilt. I am targeting .Net 4.0.
It seems like there is a project property that can be set to limit this but I'm not sure. MSDN seems to mention something along the lines that if you have multiple projects in a solution and they target different versions of the .Net framework, the list of possibilities may be limited.
In "How to: Add or Remove References in Visual Studio" MSDN mentions: "The number of tabs available at the top of the Add Reference dialog box can vary, depending on the type of project open and the resources it is using. C++ native projects contain only a Projects tab."
It doesn't really mention what these are specifically so maybe its just a broad subject. Anyways, I have stripped down the solution to only my C++ project and I can build successfully. However, I can only add References to other projects.
Apparently, setting the CLR option on the project is what opens up the list to include more options. I only wanted to enable it on one source file, but I guess Visual Studio will not add reference capabilities unless you turn it on for the whole project.
Therefore, my solution was to enable it for the whole project, add the reference, and then remove the option on the project. Basically a dirty trick but just in case people run into the same issue, that is what worked for me.
Erik

automate adding references in large VS solution

I'm working on a VS solution with 100+ projects in C#. I'm currently migrating it from VS 2008 to VS 2010. There is some work to be done because a lot of the projects use Enterprise Library 4 (which has to be upgraded to 5.0) and WCSF 2008 (which has to be upgraded to SCSF 2010). I'm going through the SCSF upgrade instructions, and one involves doing this:
Add a reference to the following
Service Location assembly in each
project that has a reference to an
Enterprise Library assembly.
Microsoft.Practices.ServiceLocation.dll
Is there any way to do this without going through the IDE? I mean, opening up each of 100-odd projects, then checking the references, then adding a reference if necessary, is one way of doing it, but is there a faster way? I was thinking along the lines of doing a search over the project files for a particular reference, then doing an insert if it was found.
If you've done this kind of thing before, suggestions would be very welcome. Thanks.
If you want to do this through the IDE, you can write a macro using VSProject.References to add/remove references as necessary.
However, C# project files (.csproj) are just XML, so you may be able to write a simple utility that can adjust the file as necessary using the standard XML classes.

Resources