Mismatch version for Autodesk.Inventor.Interop.dll

Mismatch version for Autodesk.Inventor.Interop.dll

Anonymous
Not applicable
1,527 Views
2 Replies
Message 1 of 3

Mismatch version for Autodesk.Inventor.Interop.dll

Anonymous
Not applicable

Hello Experts,

 

I am creating custom addins in autodesk inventor and  am facing an issue while referencing the Autodesk.Inventor.Interop.dll.

 

My two .csproj files refer to the dll as below. The version is 22.0.0.0. However when I open the solution in Visual Studio 2019, click on the property of Autodesk.Inventor.Interop in References, it targets to a different version 24.0.0.0 and to a different path as well for both the projects :

 

<Reference Include="Autodesk.Inventor.Interop, Version=22.0.0.0, Culture=neutral, PublicKeyToken=d84147f8b4276564, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <EmbedInteropTypes>False</EmbedInteropTypes>
      <HintPath>..\..\..\..\..\..\Program Files\Autodesk\Inventor 2018\Bin\Public Assemblies\Autodesk.Inventor.Interop.dll</HintPath>
      <Private>False</Private>
</Reference>

abhikdey_0-1630041390607.png

 

 

 

 

<Reference Include="Autodesk.Inventor.Interop, Version=22.0.0.0, Culture=neutral, PublicKeyToken=d84147f8b4276564, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <EmbedInteropTypes>True</EmbedInteropTypes>
      <HintPath>..\..\..\..\..\..\Windows\Microsoft.NET\assembly\GAC_MSIL\Autodesk.Inventor.Interop\v4.0_22.0.0.0__d84147f8b4276564\Autodesk.Inventor.Interop.dll</HintPath>
</Reference>

 

abhikdey_0-1630040011990.png

 

When building the solution, I am not sure which version it is referring to and as a result the addin is working for some users and not working for others.

 

I'd really appreciate your help to understand why this happens and how to resolve the issue.

 

Best Regards,

Abhik Dey

 

0 Likes
Accepted solutions (1)
1,528 Views
2 Replies
Replies (2)
Message 2 of 3

CattabianiI
Collaborator
Collaborator

hi @Anonymous 

The version you refer when build the solution is the one of the dll, that is the one you can see in VS, that is in your case 24. I think you can edit the csproj and write 24 if you want or set to specific version to true and your csproj will update.
I work with specific version to false and checking the real dll version via VS. 

BUT
I think in your case the problem is the Embed Interop Types setting, in one project is false in the other one is true.
Set both settings to false as recommended here
You could have to fix some casts and variables definitions because you are in C# if I remember well.


Message 3 of 3

Anonymous
Not applicable
Accepted solution

hi @CattabianiI , thank you for the suggestion. I was able to resolve the issue. When I was compiling the application it was being compiled with version 24. In few users system, there was no version 24. Thus it was not loading. To mitigate this issue, I changed the Embed Interop Types to false and Create Local copy to true. Doing so the dll was generated in the build files. Now the build is independent of the versions available in users system and will only refer to the version generated in the build.

 

Thanks a lot for suggesting!

0 Likes