Question

I'm in the process of building a custom web part in Visual Studio 2010 designed simply to report the user ID of anyone who is logged in to one of six computers on my office's network. I have found a third-party library called Cassia which exposes the Windows Terminal Services API. The web part is designed for use on a SharePoint 2010 installation.

During debugging the web part will load properly until the first time any functions from the Cassia library are used, and then I get this error:

FileNotFoundException was unhandled by user code

Could not load file or assembly 'Cassia, Version=2.0.0.60, Culture=neutral, PublicKeyToken=ccc4198e76e8f451' or one of its dependencies. The system cannot find the file specified.

I have the relevant .dll and .xml files saved in \obj\Debug and have used the Solution Explorer to add the Cassia reference from that location. I also obviously have using Cassia; in my *UserControl.ascx.cs file.

Do I need to save the Cassia .dll in the same location where the default VS2010 assembly reference files are held? Have I made some other mistake?

Was it helpful?

Solution

You need to add the Cassia DLL to the GAC or assembly folder. You can do it by using gacutil command from visual studio command prompt.

gacutil /i C:\mydll.dll

Replace the path and name of dll with yours in above.

OTHER TIPS

Given what the Cassia DLL is trying to do, it should be in the GAC so that it runs with Full Trust. Even then you may hit permissions issues but those should manifest themselves differently once you get past the initial loading of the DLL.

I suppose that the dll isn't beging deployed with your solution. SharePoint needs to know where to find the aforementioned dll. You are adding a reference to the dll in your solution but this doesn't mean that the dll is getting deployed to the server.

If this is the issue, you can resolve it by opening the Package node in your solution and then switching to the advanced tab. Here you can define any additional dll that your solution should deploy. I suggest that you first try a GAC deploy to ensure that this fix the problem, then if you need you can switch to a BIN (=WebApplication) deployment.

Please, verify if the above helps you to resolve the issue. If you need further details, please leave a notice here and I will try to update the answer.

Also, have a look to this link which provides a full guide of the process - screenshots included.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top