c# - SPItemEventReceiver and code in other assembly -
i have 4 projects inside solution:
- class library,(.net 3.5) called common.dll
- sharepoint project called sharepointstrucutre has list definition.
- sharepoint project contains sharepoint job.
both of them reference common.dll, in both packages
4 sharepoint project webpart. couldn't make work common.dll, when have added safecontrol part in web.config - webpart giving me message: type not safe , couldn't imported. ended copying code common.dll 4th project. (lame!)
worst part on local setup, working(webpart adding without typesafe messages, eventreceiver works fine). problem arise when deploying live system.
problem: in project sharepointstrucutre have spitemeventreceiver executes common.dll code. , fails! exception:
system.io.filenotfoundexception: not load file or assembly 'common, version=1.0.0.9, culture=neutral, publickeytoken=0dbfee127d760dde' or 1 of dependencies. system cannot find file specified. file name: 'common, version=1.0.0.9, culture=neutral, publickeytoken=0dbfee127d760dde'
i have checked gac, , assembly there, deployed fine.
question:
- is right decision separate sharepoint projects, , having common library? before had 1 project , causes problems upgrade , destroying created lists.
- how reference dll in right way ? won't have kind of exceptions
important update
in sharepointstrucutre have code (httpmodule) relays on common.dll , works. problem in list event receiver. there message dll couldn't loaded.
i appreciate help.
thank you
one problem @ time. let's try fix safe control.
usually error because need sign project. so...
- delete code copyed fix problem
- select class libray project (common) solution pane
- right click on project select properties
- search tab can sign project.
- you see dropdown list 2 options new or add existing (or similar). choose key sp project using, make choice.
once have done can use library in sp2010 project.
now, go sharepoint project, 1 webpart, add reference , no message should arise.
and last, not least, select package in solution pane, open package designer , select advance. here have add dll class library selecting option "add output assembly from" or similar. have choose deploy file, gac.
i think these steps should make problems go away... luck! ;)
Comments
Post a Comment