0

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 don't think, you have a point here. Both work the same. Add "Condition" to item group and it will work as long as you have that configuration in your project. – T.S. Oct 27 '16 at 23:38
  • my question was why its not being added automatically. Manually works fine. The related question has a long discussion on this. Wonder why MSFT cant just do the same for both. – Anish Eapen May 05 '17 at 20:38

1 Answers1

0

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

T.S.
  • 18,195
  • 11
  • 58
  • 78