简体   繁体   English

Vb.net项目参考库位置不同的配置

[英]Vb.net project reference libraries locations for different configuration

Related: Conditionally use 32/64 bit reference when building in Visual Studio 相关: 在Visual Studio中构建时有条件地使用32/64位引用

Normally when you add vb.net projects as reference in the same solution there is a reference added with a hint location. 通常,在同一解决方案中将vb.net项目添加为参考时,会添加带有提示位置的参考。 now in C# as far as i remember it adds it based on architecture. 据我所知,现在在C#中它是基于体系结构添加的。 Why not in Vb.net or am i just doing it wrong. 为什么不使用Vb.net或我只是做错了。 Check the related question. 检查相关问题。

<Reference Include="MyComAssembly.Interop">
<HintPath>..\..\lib\x86\MyComAssembly.Interop.dll</HintPath>
</Reference>

<ItemGroup Condition=" '$(Platform)' == 'x64' ">
<Reference Include="MyComAssembly.Interop">
<HintPath>..\..\lib\x64\MyComAssembly.Interop.dll</HintPath>
</Reference>

To clarify i do get the entry but its not architecture based by default. 为了澄清我确实得到了条目,但默认情况下它不是基于体系结构的。 The related question does talk about manually editing the file but I am trying to understand why its not happening automatically for VB.net compared to C#. 相关的问题确实涉及手动编辑文件,但是我试图理解为什么与C#相比,VB.net不会自动发生。 Is there any open feature request as well. 是否有任何开放功能要求。

Edit on 6/6/2017 for Vb.net it shows the references correctly as explained in first response, but why doesn't a COM reference work in the same way. 在6/6/2017上对Vb.net进行编辑,它可以正确显示引用,如第一次响应中所述,但是为什么COM引用不能以相同的方式工作。

I am posting this as answer, because I need to show some code here 我将其发布为答案,因为我需要在此处显示一些代码

You said: 你说:

Normally when you add vb.net projects as reference in the same solution there is a reference added with a hint location 通常,在同一解决方案中将vb.net项目添加为参考时,会添加带有提示位置的参考

Answer: 回答:

No. Project reference is created as following 否。项目参考创建如下

<ProjectReference Include="..\..\..\MyProject\MyProject.csproj">
  <Project>{7316c328-7716-4b5c-b736-f5811c764158}</Project>
  <Name>MyProject</Name>
</ProjectReference>

Your XML shows DLL reference. 您的XML显示DLL参考。 If you reference from DLL, you get the hint. 如果从DLL引用,则会得到提示。

And the ItemGroup condition is not added by default, not in C#, not in VB. 并且默认情况下,不在C#中,不在VB中添加ItemGroup条件。 This is something you do manually. 这是您手动执行的操作。 I am telling you this as build master who constantly configures projects and solutions. 我要告诉您,这是作为构建主管,他不断配置项目和解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM