In default template for Autodesk Inventor 2025 C# AddIn is missing reference to stdole. In previous versions it was possible to add this reference from COM components. But now it is not, because version (7.0.3300) is not compatible with .NET 8 and stdole is not in the list of components.
Below are three solutions how to add this reference to the new project.
My question is: Are there any potential issues with any of these or does anyone have a different solution?
1) Install stdole from NuGet package
I can install NuGet package stdole in version (7.0.3300) required by Inventor from nuget.org. There is a small issue because by default the package gives a warning.
NU1701 Package 'stdole 7.0.3300' was restored using '.NETFramework,Version=v4.6.1, ... , .NETFramework,Version=v4.8.1' instead of the project target framework 'net8.0-windows7.0'. This package may not be fully compatible with your project.
This warning can be suppressed in package properties or directly in project file.
<ItemGroup>
<PackageReference Include="stdole" Version="7.0.3300">
<NoWarn>NU1701</NoWarn>
</PackageReference>
</ItemGroup>
2) Copy the stdole.dll file to project and reference them as assembly
In this case I just need to set Embed Interop Types to No (False in project file)
3) Add reference to COM component manually
In VB.Net addin project is this reference added directly in project file using this piece of code. It works, but it is little bit obscure for me.
<ItemGroup>
<COMReference Include="stdole">
<Guid>{00020430-0000-0000-C000-000000000046}</Guid>
<VersionMajor>2</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
</ItemGroup>