I want to reference a COM DLL in a .NET project, but I also want to make sure that the interop DLL created will have the correct version (so that patches will know when the DLL must be changed).
If I use TlbImp
I can specify the required version with the /asmversion
flag but when I add it directly from Visual Studio it gets a version that has nothing to do with the original COM DLL's version.
I tried changing the version in the .vcproj
file
<ItemGroup>
<COMReference Include="MYDLLLib">
<Guid>{459F8813-D74D-DEAD-BEEF-00CAFEBABEA5}</Guid>
<!-- I changed this -->
<VersionMajor>1</VersionMajor>
<!-- This too -->
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
</COMReference>
</ItemGroup>
But then the project failed to build with the following error:
error CS0246: The type or namespace name 'MYDLLLib' could not be found (are you missing a using directive or an assembly reference?)
Is there any way to get this done without creating all my COM references with TlbImp
in advance?
If the answer is yes is there a way to specify a build number in addition to the major and minor versions? (e.g 1.2.42.0)