Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
    
Pardon my ignorance, but what is the GAC? –  JonnyP Mar 14 '12 at 15:51
    
the GAC or Global Assembly Cache is where .Net assemblies (DLLs) are placed so that they can be readily accessed by applications that need them. More Info : codeproject.com/Articles/4352/… –  Dave Wise Mar 14 '12 at 15:54
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.