PowerPoint.Application.Presentations missing MsoTriState
Solution 1:
It looks like the interop assemblies were generated improperly by tlbimp
at the certain point. You can find that assembly at \obj\Debug\netcoreapp3.1\Interop.Microsoft.Office.Interop.PowerPoint.dll
.
To re-generate it properly, you need to do the following:
- Remove the reference to "Microsoft PowerPoint 16.0 Object Library". Clean and rebuild the project. You may also try unloading the project and removing the
bin
andobj
folders manually at this point. - Add references to both "Microsoft 15.0 Object Library" and "Microsoft 16.0 Object Library".
- Add back reference to "Microsoft PowerPoint 16.0 Object Library", and clean and rebuild the project once more.
After performing these steps, my .NET Core 3.1 WinForms project was compiled successfully.
Here are the contents of the .csproj
file in my case:
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
</PropertyGroup>
<ItemGroup>
<COMReference Include="Microsoft.Office.Core">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>8</VersionMinor>
<VersionMajor>2</VersionMajor>
<Guid>2df8d04c-5bfa-101b-bde5-00aa0044de52</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
<COMReference Include="Microsoft.Office.Interop.PowerPoint">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>12</VersionMinor>
<VersionMajor>2</VersionMajor>
<Guid>91493440-5a91-11cf-8700-00aa0060263b</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
</COMReference>
</ItemGroup>
</Project>