简体   繁体   中英

Vb.net project reference libraries locations for different configuration

Related: Conditionally use 32/64 bit reference when building in Visual Studio

Normally when you add vb.net projects as reference in the same solution there is a reference added with a hint location. now in C# as far as i remember it adds it based on architecture. Why not in Vb.net or am i just doing it wrong. 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#. 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.

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

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. If you reference from DLL, you get the hint.

And the ItemGroup condition is not added by default, not in C#, not in VB. This is something you do manually. I am telling you this as build master who constantly configures projects and solutions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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