Hey Chris,

 

Worth a shot, but no, all references in that project are System.*.
Cheers.

 

 

Kind regards,

 

Chris

 

From: [email protected] [mailto:[email protected]] On Behalf Of Chris
Tomich
Sent: Tuesday, 28 July 2009 3:51 PM
To: [email protected]
Subject: Re: Web part with dll reference

 

Hi Chris,

Shot in the dark here but does your externally referenced assembly have
references to other assemblies that you aren't deploying?

Kind Regards,
Chris Tomich

On Tue, Jul 28, 2009 at 1:44 PM, Chris Milne
<[email protected]> wrote:

Thanks Jeremy [update: and Sezai].

 

Yep, sorry, 'tis VSeWSS 1.3 CTP using WSP.

 

Copy Local is set to true on my reference and it does indeed deploy both
my web part and referenced assembly to c:\windows\assembly\.

 

I tried manually adding a <SafeControl> entry to the web.config for my
referenced assembly to no avail, same result.

 

Also found in SP log:

http://server/chris/default.aspx - An unexpected error has been
encountered in this Web Part.  Error: This page has encountered a
critical error. Contact your system administrator if this problem
persists.

 

.which unfortunately is no more exciting than what I'm seeing on the
page.  Have followed this
<http://www.andrewconnell.com/blog/archive/2007/02/01/5935.aspx>  post
to turn on extra debug info, am now seeing this on page:

 

Web Part Error: A Web Part or Web Form Control on this Page cannot be
displayed or imported. The type could not be found or it is not
registered as safe.

Show Error Details <http://dvsdev001/chris/default.aspx>  

Hide Error Details <http://dvsdev001/chris/default.aspx>  


[UnsafeControlException: A Web Part or Web Form Control on this Page
cannot be displayed or imported. The type could not be found or it is
not registered as safe.]
  at
Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Gui
d guid) 
  at
Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRow
SetData(Boolean onlyInitializeClosedWebParts)

 

So not found or not safe.. hmm.  Both assemblies now have <SafeControl>
entries and are in c:\windows\assembly\.

 

In my external library, my assembly name is the same as my default
namespace, is this allowed/problematic?

 

Kind regards,

 

Chris

 

From: [email protected] [mailto:[email protected]] On Behalf Of Jeremy
Thake
Sent: Tuesday, 28 July 2009 3:01 PM
To: [email protected]
Subject: RE: Web part with dll reference

 

So are you using the VSeWSS 1.3 CTP when you say Visual Studio projects?

 

I'm assuming you must be using a WSP if its automatically adding the
SafeControl entry.

 

The reason you're probably getting this error is because you need to
ensure you deploy the external library with the package. To do this,
ensure you have Copy Local set to true in the properties. If it's VSeWSS
you're using, you can check the manifest.xml file and see whether an
Assembly element has been added for it. Also you can check it's deployed
by going to c:\windows\assembly and ensuring the dll is in there ;-)

 

Jeremy Thake

Readify | Senior Consultant

M: +61 400 767 022 | E: [email protected]
<mailto:[email protected]>  | W: www.readify.net
<http://www.readify.net/> 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Chris
Milne
Sent: Tuesday, 28 July 2009 12:41 PM
To: [email protected]
Subject: Web part with dll reference

 

Afternoon all,

 

I'm developing a web part in which I would like to reference
functionality that exists in one of our other company Visual Studio
projects (.net assembly/dll).  I'm having trouble doing this and hoping
someone can point me in the right direction J  I've created a simple VS
web part project which works if I deploy it just by itself (not using
the library functionality).  I then added a reference to my dll, added a
'using' to import the namespace into my code (if I deploy again at this
point it still works), but if I add one line of code that uses the
external library into CreateChildControls() and deploy, I get a generic
'Error An Unexpected error has occurred' message on a page the webpart
exists on.

 

Visual Studio is automatically adding a <SafeControl Assembly=..> to my
web.config for my web part assembly but not the external library
assembly, do I need to add that?  Both assemblies are automatically
being added to the GAC.  Any help is appreciated!

 

 

Kind regards,

 

Chris

________________________________

Support procedure: https://www.codify.com/lists/support
List address: [email protected]

Subscribe: [email protected]

Unsubscribe: [email protected]

List FAQ: http://www.codify.com/lists/ozmoss
<http://www.codify.com/lists/ozmoss> 

Other lists you might want to join: http://www.codify.com/lists
<http://www.codify.com/lists> 

________________________________

Support procedure: https://www.codify.com/lists/support
List address: [email protected]

Subscribe: [email protected]

Unsubscribe: [email protected]

List FAQ: http://www.codify.com/lists/ozmoss
<http://www.codify.com/lists/ozmoss> 

Other lists you might want to join: http://www.codify.com/lists
<http://www.codify.com/lists> 

________________________________

Support procedure: https://www.codify.com/lists/support
List address: [email protected]

Subscribe: [email protected]

Unsubscribe: [email protected]

List FAQ: http://www.codify.com/lists/ozmoss
<http://www.codify.com/lists/ozmoss> 

Other lists you might want to join: http://www.codify.com/lists
<http://www.codify.com/lists> 

 

________________________________

Support procedure: https://www.codify.com/lists/support
List address: [email protected]

Subscribe: [email protected]

Unsubscribe: [email protected]

List FAQ: http://www.codify.com/lists/ozmoss
<http://www.codify.com/lists/ozmoss> 

Other lists you might want to join: http://www.codify.com/lists
<http://www.codify.com/lists> 

--------------------------------------------------------------------------------
Support procedure: http://www.codify.com/lists/support
List address: [email protected]
Subscribe: [email protected]
Unsubscribe: [email protected]
List FAQ: http://www.codify.com/lists/ozmoss
Other lists you might want to join: http://www.codify.com/lists

Reply via email to