Why does Visual Studio only allow one link per file in a project?

4k views Asked by At

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."

4

There are 4 answers

5
Doc Brown On BEST ANSWER

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.

0
Mark Redman On

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?

1
Evgeny On

You could create several links to one file on ONE project, but manually and VS will not show it in project tree.

unload project and add for example links:

<Content Include="..\..\_Common\js\JQuery\jquery.js">
  <Link>Sites\OrgCatalogSite\Design\js\JQuery\jquery.js</Link>
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>


<Content Include="..\..\_Common\js\JQuery\jquery.js">
  <Link>Sites\TasksManagersSite\Design\js\JQuery\jquery.js</Link>
  <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
0
wisdom On

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

In details. The server is in java (WebSphere Application Server/7.0). The 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 changes the 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?