peterng

I have a custom web part that seems not to be able to access an assembly i have referenced, the error is File or assembly name myassembly, or one of its dependencies, was not found.None Ive added the assembly to the gac and added it to the safe controls in the config. Am I missing another step



Re: SharePoint - Development and Programming Questiong about Web parts referencing an assembly

Curtis Ruppe (MicroStaff IT)

Yes, you must use the fully qualified the assembly name (Assembly, Version=x.x.x.x, Culture=neutral, PublicKeyToken=xxxxxxxxxxxx) very much like the rest of the SafeControl entries.



Re: SharePoint - Development and Programming Questiong about Web parts referencing an assembly

peterng

Not sure what you mean, could you give me directions, thanks



Re: SharePoint - Development and Programming Questiong about Web parts referencing an assembly

Curtis Ruppe (MicroStaff IT)

You already added the SafeControl entry, right Within the SafeControl entry of the web.config, update your SafeControl entry to include the information you see in C:\Windows\assembly



Re: SharePoint - Development and Programming Questiong about Web parts referencing an assembly

peterng

This is what ive done.

Ive added both assembly's in the GAC.

this is what i have for my safe control entry already.

<SafeControl Assembly="myassembly.assembly, Version=1.0.0.0, Culture=neutral, PublickeyToken=ac794d3e89156838"

Namespace="myassembly.assembly" TypeName="*" Safe="True" />

<SafeControl Assembly="myassembly.webpart, Version=1.0.0.0, Culture=neutral, PublickeyToken=478ed6711a45f46e"

Namespace="myassembly.webpart" TypeName="*" Safe="True" />

When i reference the myassembly.assembly in the Webpart project, I am referencing it to the file myassembly.assembly.dll.

What else am i missing





Re: SharePoint - Development and Programming Questiong about Web parts referencing an assembly

David Smith (MicroStaff IT)

According to what you've listed above, your assembly is compiled and installed into the GAC as myassembly.assembly.dll, and your webpart is compiled into myassembly.webpart.dll. Furthermore, your WebPart is has an fully-qualified name of myassembly.webpart.webpart1 (or something like that). And those strings match right down to the appropriate case.

If any of those things are not true, then you want to make corresponding changes. Right now, I suspect that you've given the full class name of the Web Part instead of just the fully qualified namespace in the "Namespace" attribute.

Also, you want to make sure that the "Copy Local" attribute of the reference to myassembly.assembly.dll is set to "false" in the original web part project, ensuring that the web part does pick up its reference from the GAC.

And it's a minor nit to pick, but you should set your fully qualified reference to PublicKeyToken (note the capitalized "K") to be consistent with SharePoint's methodology. It won't fix your problem, but it doesn't hurt to fix it, either.






Re: SharePoint - Development and Programming Questiong about Web parts referencing an assembly

Curtis Ruppe (MicroStaff IT)

The only SafeControls entry you need is for anything that uses a control or UI. The assembly you are referencing that is not a web part is not required to be in the SafeControls section of the web.config file. Verify, as David has said, that your project's reference to the assembly used the GAC version of the assembly, and had the Do Not Copy option specified.



Re: SharePoint - Development and Programming Questiong about Web parts referencing an assembly

peterng

Thanks for your help, I found out what the problem was, the assembly im referencing is a com+ service that I needed to delete and let it reinstall itself.