Answer the question
In order to leave comments, you need to log in
How to run C# DLL library under office for x86 and x64?
Hello
I'm trying to build and run Dll for Office (for Excel in particular). The library is written in C#.
Collected an example on this lesson
So.
In VisualStudio 2019, a project was created using the "NET.Framework Class Library" template.
In Preferences checkbox is checked for "Make assembly visible to COM", Target NET 3.5 workbench
using System.Runtime.InteropServices;
namespace howto_dll_for_excel
{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDual)]
public class CSharpTools
{
[ComVisible(true)]
public string AddBrackets(string value)
{
return "[" + value + "]";
}
}
}
C:\Windows\Microsoft.NET\Framework\v2.0.50727\regasm.exe
and keys /tlb /codebase
Класс не зарегистрирован
C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe
the error remains relevant Answer the question
In order to leave comments, you need to log in
I had outdated information. So, I lied in the comment. The Regasm that you are using is 32-bit and all of its entries are in WOW64, including entries in the registry. Use the x64 build console to have regasm write to the correct registry branch. To correctly install the library you will need to call 2 different regasm!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question