Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > Add as Link and name space
 

Add as Link and name space

In Visual Studio 2005, whenwe add an existing item, we can choose "add aslink" which does not physically copy the file, but only add a link to the file. It works well and is a helpful feature.

The question I have is that how to deal with the name space issue.

for example, if I define class Common in file common.cs:

usingSystem;
publicclassCommon
{
}

In project A( namespace Company.NSA ), I add common.cs as link.

In projectB( namespace Company.NSB ), I add common.cs as link.

What I want is that I will have have two classes: Company.NSA.Common and Company.NSB.Common - how can I have this?

TIA

webcliff  Friday, January 30, 2009 3:01 PM
Hi,

I don´t be sure ifit can help you, but may give you a idea.


http://social.msdn.microsoft.com/Forums/en-US/vsx/thread/fec8246b-dc5c-4a4f-b127-b7df01add068/


I think that it is not easy.
The post recommend you that you must see the IronPhyton code, because thisfunctionality is developed in this package, remember with the VS2008 SDK, you have this example code.

I didn´t see the IronPhyton code yet.


I could see that exist the AddExistingItem() method, but it don´t have the "as link", o similar parameter:

http://msdn.microsoft.com/es-es/library/envdte.itemoperations.addexistingitem.aspx


greetings
Leandro Tuttini
Leandro Tuttini  Saturday, January 31, 2009 5:49 PM
Hi TIA,

Is very straight forward, you can use the following snippet

DTE dte = GetService<DTE>();
Project project = DteHelper.GetSelectedProject(dte);
project.ProjectItems.AddFromFile(@"c:\foo.cs");


If the file is outside the project it will be added as a a link.

hth.
jose.




Jose Escrich - weblogs.asp.net/jescrich
  • Proposed As Answer byJose Escrich Thursday, February 19, 2009 6:58 PM
  •  
Jose Escrich  Thursday, February 19, 2009 6:41 PM

You can use google to search for other answers

Custom Search

More Threads

• Can't remove GAX/GAT on Vista
• Error while using Guidance package in Ent Lib 3.0 for Strong Naming DLLs
• Unable to add project reference to a web project
• Binding error (?) using Smart Client Software Factory
• a strange problem when we use Automation Toolkit
• Problem Using Newly Created Guidance package in VS 2005
• VSTS - Web Test - FIND TEXT command
• "Add new module" recipe customization
• A Bug in DteHelper?
• Microsoft.Jet.OLEDB.4.0