views:

254

answers:

3

I would like to have a file in several different projects of a solution, however, Visual Studio only allows one link per solution to the file. Is there a way around this?

What is the issue of having several soft links to a single file within a VS project?

Update: I have added the link as described from the comments below, it seems that the issue is on a per project basis. There can not be multiple links to the same file within the project. When I attempt to add the link I receive the following error - "There is already a link to ''. A project cannot have more than one link to the same file."

A: 

Not sure what you want to achieve or what kind of file it is, but you could create a new project with that file in it and reference that project from each of the projects that require it? If its a code file, then its will be within scope, if its some other file with "Copy Always" then it will be copied into the various projects bin folder when built?

Mark Redman
+1  A: 

I am using Visual Studio 2008 Professional, and it allows the same file from one project to be soft-linked to every other project, independently of the number of solution files you are using.

Doc Brown
Perhaps I'm doing it wrong, how are you adding the softlinks?
Eric U.
Works for me by doing an Add > Existing Item then choosing Add As Link from the Add button drop-down in the file selection box.
itowlson
Just the way it is described here:http://msdn.microsoft.com/en-us/library/9f4t9t92%28VS.80%29.aspx
Doc Brown
@itowlson I have updated the question. I only run into the issue when adding a link to a file within a different folder of the same project, not solution
Eric U.
Same file more than one time in the same project? Can you be a little bit more specfic wht you are trying do achieve?
Doc Brown
A: 

I wish I could add more than one link to the same .XSD/.WSDL file in one project.

In details. Server is in java (WebSphere Application Server/7.0). Client dll in c#. We use contract-first approach. In Visual Studio 2008 I Add Service Reference. But instead of my original WSDL/XSD contracts it retrieves dummy XService.wsdl and XService_schema1.xsd and generates "not so dev friendly" code (with message wrappers, xFieldSpecified stuff, dummy ArrayOfx collections...). So what I do? I change Reference.svcmap so that it includes exactly original WSDL/XSD contracts and paste them from where they belongs. That's ok, I get dev friendly code and I am happy :) But what if someone change server contract? Here I can't just Update Service Reference. I have to copy-paste new contracts to my Service Reference folder any time contract been changed. To sum up, I need to add my original WSDL/XSD files As Links to all Service Reference folders in order to simplify contract changing process. Just check out new WSDL/XSD, right click Reference.svcmap > Run Custom Tool.

Isn't that worthy feature?

wisdom