为什么 Visual Studio 只允许项目中的每个文件有一个链接?

发布于 2024-08-13 20:10:03 字数 268 浏览 4 评论 0原文

我希望在一个解决方案的多个不同项目中拥有一个文件,但是,Visual Studio 只允许每个解决方案有一个到该文件的链接。有没有办法解决这个问题?

VS 项目中的单个文件有多个软链接会出现什么问题?

更新:我已经添加了下面评论中所述的链接,看来该问题是基于每个项目的。项目内不能有指向同一文件的多个链接。当我尝试添加链接时,我收到以下错误 - “已经有一个指向 '' 的链接。一个项目不能有多个指向同一文件的链接。”

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

幻梦 2024-08-20 20:10:03

您可以在一个项目上创建指向一个文件的多个链接,但手动创建,VS 不会在项目树中显示它。

卸载项目并添加示例链接:

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

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>
街角迷惘 2024-08-20 20:10:03

我使用的是 Visual Studio 2008 Professional,它允许将一个项目中的同一文件软链接到每个其他项目,而与您使用的解决方案文件的数量无关。

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.

一腔孤↑勇 2024-08-20 20:10:03

不确定您想要实现什么或它是什么类型的文件,但您可以创建一个包含该文件的新项目,并从每个需要它的项目中引用该项目?如果它是一个代码文件,那么它将在范围内,如果它是一些带有“始终复制”的其他文件,那么它会在构建时复制到各个项目的 bin 文件夹中?

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?

×眷恋的温暖 2024-08-20 20:10:03

我希望可以在一个项目中向同一个 .XSD/.WSDL 文件添加多个链接。

详细来说。
服务器采用 java (WebSphere Application Server/7.0) 语言。 C# 中的客户端 dll。我们使用合同优先的方法。

在 Visual Studio 2008 中,我添加了服务引用。但它不是检索我原来的 WSDL/XSD 合约,而是检索虚拟 XService.wsdl 和 XService_schema1.xsd 并生成“不太适合开发”的代码(带有消息包装器、xFieldSpecified 内容、虚拟 ArrayOfx 集合...)。那我该怎么办?我更改了 Reference.svcmap,使其包含完全原始的 WSDL/XSD 合约,并将它们从所属位置粘贴。没关系,我得到了开发人员友好的代码,我很高兴。

但是如果有人更改服务器合同怎么办?在这里我不能只更新服务参考。每当合同发生更改时,我都必须将新合同复制粘贴到我的服务参考文件夹中。

总而言之,我需要将原始 WSDL/XSD 文件作为链接添加到所有服务参考文件夹,以简化合同更改过程。只需查看新的 WSDL/XSD,右键单击 Reference.svcmap >运行自定义工具。

这不是值得的功能吗?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文