Im using .NET Framework 4.8 and Im using the ClosedXML Library,but my programm is an class Library type of programm so that the dll of the programm will land in an different folder where all other additional dll like the closedXML dll are not allowed to be there in that folder. So if i want to execute the dll I get error message that the Assembly references not are found, which is logic because in the other folder all the dll like closedXML are not in the folder and cant be referenced.
So what I tried to do is to embedded the Interop Type set to true.
But when I set it to true I get these two Error Messages:
Error CS1747 Interoptypes cannot be embedded from assembly "DocumentFormat.OpenXml, Version=2.19.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17" because the System.Runtime.InteropServices.GuidAttribute attribute is missing.
and
Error CS1759 Cannot embed interoptypes from assembly "DocumentFormat.OpenXml, Version=2.19.0.0, Culture=neutral, PublicKeyToken=8fb06cb64d019a17" because either the System.Runtime.InteropServices.ImportedFromTypeLibAttribute attribute or the System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute attribute is missing.
what I tried to fix this problem was at first rebuild entire solution and install the dll new.
And I tried to add this Code to the assemblyinfor.cs file:
[assembly: System.Runtime.InteropServices.Guid("2e197457-53cd-4261-81b6-07c65281b2a3")][assembly: PrimaryInteropAssembly(1, 0)]
but I get the Error message still, all the dll are on the newest version.
Someone an Idea how to set the Interop Type to true without getting this Error message?