Reputation: 215
I have 2 projects,
The first project C# project where I have a blank form(new project). I am compiling this form as a dll so I can reference the form.
The VB project is an ExcelDNA project which consists of a custom task pane with a button to open the form,the task pane works fine. However, I get the following error when clicking the Button:
System.IO.FileNotFoundException: Could not load file or assembly
I can get this to work by creating a UserControl in the VB project, and then accessing it via the Button, however I have the form written in C# already and do not want to convert it to VB.
Upvotes: 0
Views: 4062
Reputation: 215
So the answer to this is to make sure your form Dll is copied to the directory where your Excel Add-In is sitting.
Upvotes: 0
Reputation: 18472
There is no need to convert the project to VB.NET. This error is because the .net runtime cannot find the assembly (dll or exe that contains your first form). In Visual Studio, open the Solution Explorer
window and expand the References
node. Right-click the reference to your first assembly and click Properties
. In the properties window change the Copy Local
as True
.
This way Visual Studio will copy the assembly to the output folder of the project ('bin\Debug' or 'bin\Release').
Upvotes: 1