Solución para o problema: “FileNotFoundException” Co meu recurso Receiver.

I was working on a feature last week that would add some event receivers to a specific list instance. (Eu escribín un pouco sobre esta lista receptor aquí).

Usar a liña de comandos, Podería instalar o recurso sen erro (pero mira abaixo o erro oculto). When I tried to deploy the feature on the site, MOSS complained of a "FileNotFoundException" error. This blog entry describes how I solved it.

Este é o erro que Moss me mostrou o navegador web:

Feature ‘b2cb42e3-4f0a-4380-aaba-1ef9cd526f20’ could not be installed because the loading of event receiver assembly "xyzzyFeatureReceiver_0" fracasado: System.IO.FileNotFoundException: Could not load file or assembly ‘xyzzyFeatureReceiver_0’ ou unha das súas dependencias. O sistema non pode atopar o ficheiro especificado.
O nome do ficheiro: ‘xyzzyFeatureReceiver_0’
at System.Reflection.Assembly.nLoad(AssemblyName filename, Codebase cadea, AssemblySecurity evidencia, Asemblea locationHint, StackCrawlMark& apilar solo, Booleana throwOnFileNotFound, ForIntrospection Boolean)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, AssemblySecurity evidencia, StackCrawlMark& apilar solo, ForIntrospection Boolean)
at System.Reflection.Assembly.InternalLoad(Cordas assemblyString, AssemblySecurity evidencia, StackCrawlMark& apilar solo, ForIntrospection Boolean)
at System.Reflection.Assembly.Load(Cordas assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
WRN: Rexistro de conexións de assembly está desactivado.
Para activar o rexistro de erros de assembly, definir o valor de rexistro [HKLM Software Microsoft Fusion!EnableLog] (DWORD) para 1.
Nota: Hai algunha perda de rendemento asociada ao rexistro de fallo de conexión de assembly.
Para desactivar este recurso, elimine o valor do Rexistro [HKLM Software Microsoft Fusion!EnableLog].

Solucionar problemas con Windows SharePoint Services.

Sei como facer que deliberadamente este erro: don’t install the assembly in the GAC. Pero, it was in the GAC. I normally install assemblies into the GAC by dragging them into the c:\windows\assembly folder using windows explorer. I’ve never felt 100% cómodo facendo iso, porque eu sempre pensei que Gacutil existiu por unha razón … so I tried that. It made no difference.

Eu procurei as Internets e atopei este post: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2243677&SiteID=1

O cartel pasou a ser co mesmo bit raíz do código (do libro WSS Dentro desta lista) so that was a hopeful sign. Con todo, a suxestión de decorar a montaxe cunha [montaxe: ] directive didn’t make sense to me. I tried it anyway and I was right. It made no difference.

Then I noticed that my class definition was not public. I made it public and that made no difference.

Seguinte, I went to the trouble of enabling the "assembly bind failure log" (seguindo as instrucións útiles e precisas proporcionadas) and this is where things started to get interesting. That log shows me that the runtime is searching everywhere on that server for my assembly. It even appears to be searching for it in my medicine cabinet. Pero … non vai buscalo no GAC.

I put on my winter jacket and go searching the Internets again and find that someone has had this problem too. The lengthy discussion in that posting peters off into nothing and I can’t find a solution.

I move my assembly into one of the places the log claims it’s searching and I make a little more progress. I’m rewarded with a new error in the browser when I try to activate the feature:

Failed to create feature receiver object from assembly "xyzzyFeatureReceiver_0", type "Conchango.xyzzyFeatureReceiver" ao recurso de b2cb42e3-4f0a-4380-aaba-1ef9cd526f20: System.ArgumentNullException: O valor non pode ser nulo.
O nome do parámetro: tipo
at System.Activator.CreateInstance(Tipo Tipo, Booleana nonPublic)
at System.Activator.CreateInstance(Tipo Tipo)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

Solucionar problemas con Windows SharePoint Services.

Tempo para unha última viaxe para as Internets!

Esta vez descubro, previsiblemente, that MOSS issues this error because the assembly is not in GAC.

Quero aproveitar algo positivo deste e tentar sentir algo orgulloso de que eu creei o Fugitivo de conxuntos MSIL, but it’s not working. I’m just plain annoyed. I find myself muttering "chicken or the egg" baixo a miña respiración.

I finally decide to punt. I create an entirely new project and copy/paste the code from the incredible-cloaked-from-the-GAC-assembly non-working project over to this new project. (I look for a build flag called something like "hide from assembly binding if installed in the GAC" pero non pode atopar un).

Eu instalar recurso e activa-lo e … funciona! Así, despois de todo isto, I had to basically ‘reboot’ my project. Esta é outra razón pola que eu odio ordenadores.

I did learn something useful from this. I had been installing features using the stsadm command line all day long and been using the "-force" option out of habit. Por algunha razón, I did not use the -force option when I installed the new project. Este tempo, Eu fixen realmente, truly forget to copy this new project’s assembly into the GAC. Como resultado, I received that "FielNotFoundException" error. Este tempo, I got it from stsadm, not when I tried to activate the feature via the web browser. Así, -force actually plays two roles. It allows you to re-install an existing feature. It also allows you to install a buggy feature that cannot work at runtime by suppressing the error. It probably says as much in the help somewhere but I never noticed it.

</final>

Domingo divertido: Arriba 10 Formas de o irritar súa esposa

  1. Mercar brócolis cando vostede sabe que xa é máis que suficiente na neveira.
  2. Go for a run. Cool off. Take off clean pillow case and replace with T-shirt. Cover with clean pillow case.
  3. Ao dirixir, preguntar se hai que ir polo camiño mal por unha rúa de sentido único.
  4. Para 15 anos, todos os domingos que suxire esposa ir a un museo, expresa sorpresa que os museos están abertos os domingos.
  5. Para 15 anos, occasionally suggest going to the local book store on Sunday. Express surprise that they are not open on Sunday’s (moitas grazas Leis Azul!).
  6. Usar 20 puntos para facer un 3 point turn.
  7. Nunha tarde de outono cedo legal, walk into the room and turn on the A/C. Complain that it’s cold. When wife says, "then why did you turn that on, parvo" e obtén-se desactiva-lo, grab the warm spot she had on the couch. Bonus points if she does not realize you did it until much later.
  8. Abrir unha lata de atún delicioso branco e come-lo directamente da lata, na cama, á noite.
  9. Vaia á cociña mentres a muller está comendo a cea, abrir o caixón de cubertos e utensilios de empurrar ata berros muller, "what are you looking for!"
  10. Momento da recepción de novas tarxetas de visita, secretly place them all around the house: Under the bed, in pillow cases, inside coffee cups, in her purse, in coat pockets, car glove compartments, the pantry — anywhere you can think of.
  11. Write blog entries about your wife.
  12. Wake up.
  13. When walking the streets of New York City, be on the alert for "crusty" objects on the ground. Keeping in mind your wife’s special fears, reach down as if to pick one up up and ask, "hmm, Eu me pregunta o que é?" (Be prepared for wife to body slam you as if she’s a secret service agent protecting the President from a sniper or you’ll find yourself laying on your back on the sidewalk).
  14. Drive twice around a parking lot looking for space. You know you’ve really hit pay dirt when your son in the back seat yells, "Oh no! He’s doing it novo!"
  15. Write "top 10" lists that don’t have 10 items.

===

Bonus wife joke:

Two male co-workers go out to lunch. One of them tells the other, "I let loose an embarrassing Freudian slip the other night."

"A Freudian slip? What’s that?"

"Well, when we finished eating, the waitress came by and asked how we liked our meals. I meant say, ‘I loved the chicken breast’ but instead I said ‘I loved your breasts’. I was so embarrassed."

"Ah," his co-worker replied. "I had the same thing happen to me this weekend with my wife. We were eating breakfast I meant to ask her to pass the butter, but instead I screamed at her, ‘You ruined my life!'"

</final>

Technorati Tags:

ID do evento 1023: “Windows non pode cargar extensibles MSSCNTRS DLL do contador”

Actualización (04/08/08): I seem to have solved this problem. From the command line, Eu corrín "c:\Windows system32 lodctr / R" por unha entrada falando sobre problemas InstallShield e que parece ter resolto iso por min.

Teño notado que ultimamente, my desktop/server fan never turns off. I know it used to turn off. I took a moment to check it out noticed that the a VMware process was running a consistent 20% utilization on one of the CPU’s. I checked the event log and saw these errors in the application log happening dozens of times per minute:

Windows non pode cargar UGatherer DLL extensible contador, a primeira DWORD na sección de datos é o código de erro de Windows.

Windows non pode cargar UGTHRSVC DLL extensible contador, a primeira DWORD na sección de datos é o código de erro de Windows.

Windows non pode cargar extensibles MSSCNTRS DLL do contador, a primeira DWORD na sección de datos é o código de erro de Windows.

Se eu furar os detalles dunha daquelas mensaxes, Eu teño ese:

Orixe: Perflib

Tipo: Erro

Categoría: Ningún

ID do evento 1023

I did some research and there was some indication it could be a permission problem in terms of access to the DLLs in question. I played around with that stuff but could not affect things in a positive way so I gave up on that.

VMware estaba me incomodando sobre como executar unha actualización por un tempo, entón eu anotei a versión que eu tiña instalado (aparentemente "1.0.1 construír 29.996") and did the update. This upgraded me to v1.04. Desafortunadamente, non resolver o problema.

I can stop the insane number of messages going to my application log if I shut down a service named "VMware Authorization Service". This prevents me from using the VMware software, así … not such a great option.

O sistema operativo anfitrión é o Windows XP 64 bocado.

Eu non creo que iso sempre pasou, pero eu non me recordo de ningún evento específico que podería levar a el.

É por iso que eu odio ordenadores.

</final>

Technorati Tags:

Rápido & Fácil: Renomear o ficheiro cargado empregando SharePoint obxecto Model a través dun receptor de eventos

Actualización: This works but there are significant limitations which are described in the comments. This may still be useful in some cirumstances.

Actualización 2: O meu proxecto actual, users always upload documents. Como resultado, I don’t run into a problem where MS Word is running and thinks that the file was renamed on it. I did run into a problem, "the file was modified by someone else" and solved this via a simple semaphore type flag. Users need to change a meta data field from its default value to something else. The itemupdated() receptor busca por un valor válido alí antes de realmente facer a renomeação e desde entón, I have not had any problems. Your mileage may vary.

I have a client requirement to change the name of files uploaded to a specific document library to conform with a particular naming convention. The API does not provide a "rename()" método. Pola, usan "MoveTo(…)". Here is a minimal bit of code to accomplish this:

 público substituír invalidar ItemAdded(SPItemEventProperties Propiedades)
        {
            SPFile f = properties.ListItem.File;

            f.MoveTo(properties.ListItem.ParentList.RootFolder.Url + "/xyzzy.doc");
            f.Update();

        }

The only tricky bit is the "properties.ListItem.ParentList.RootFolder.Url". The MoveTo() method requires a URL. That mashed up string points me to the root folder of my current document library. This allows me to avoid any hard coding in my event receiver.

Esta é unha versión máis útil que fai o mesmo, but assigns the name of the file to "Title":

 público substituír invalidar ItemAdded(SPItemEventProperties Propiedades)
        {
            DisableEventFiring();

            // Asignar o título deste artigo para o nome do ficheiro en si.
 // NOTA: Esta asignación debe ocorrer antes de modificar o propio arquivo.
 // Chamando actualización() no SPFile parece invalidar as propiedades en
 // nalgún sentido.  Updates to "Title" puido ata que o cambio (e actualización() chamar)
 // foron movidos fronte á mudanza do nome do ficheiro.
            properties.ListItem["Title"] = Properties.ListItem.File.Name;

            properties.ListItem.Update();

            SPFile f = properties.ListItem.File;

            // Obter a extensión do ficheiro.  Necesitamos que máis tarde.
 corda spfileExt = novo FileInfo(f.Name).Extensión;

            // Renomeie o ficheiro para a identificación do elemento da lista e utilizar a extensión do ficheiro para manter
 // que parte dela intacta.
            f.MoveTo(properties.ListItem.ParentList.RootFolder.Url +
                "/" + properties.ListItem["ID"] + spfileExt);

            // Comprometer o movemento.
            f.Update();

            EnableEventFiring();
        }

Foro de debate: Impoñendo prácticas en Compliance Ambiente Moss non-trivial

Un compañeiro, "Mark", has started up a potentially interesting newsgroup discussion focusing on "establishing excellent SharePoint Governance from the start" para unha 35,000 ambiente do usuario.

A discusión é aquí: http://groups.google.com/group/microsoft.public.sharepoint.portalserver/browse_thread/thread/6d9a738d981af772/1c390b15c5407db6?#1c390b15c5407db6

Pop en máis e contribuír!

</final>

URL acción personalizada non aparecerá a New Features

I’m still in the habit of crafting my feature XML files by hand since it’s all quite new to me. I don’t want to rely on a front-end tool that does stuff I don’t understand (el dixo como escribiu un blog usando unha ferramenta que non entende).

Hoxe, I was trying to add a custom action to the site settings but it just wouldn’t show up. I could install the feature and see it in the site features, pero cando activei (sen erro) el simplemente non estaba a aparecer no menú desplegable.

I finally realized that I misspelled "SharePoint" o atributo de localización do <CustomAction> node. This is the bad elements.xml file:

<?xml versión="1.0" codificación="utf-8" ?>
<Elementos xmlns="http://schemas.microsoft.com / SharePoint /">
  <CustomAction
 Id="SiteActionsToolbar"
 GroupId="SiteActions"
 Localización="Microsoft.Sharepoint.StandardMenu"
 Secuencia="100"
 Título="Ola!"
 Descrición="Acción menú personalizado engadido mediante unha característica."
 ImageUrl="_layouts / images / menuprofile.gif">

    <UrlAction Url="http://www.xyzzy.com"/>

  </CustomAction>
</Elementos>

Bo:

<?xml versión="1.0" codificación="utf-8" ?>
<Elementos xmlns="http://schemas.microsoft.com / SharePoint /">
  <CustomAction
 Id="SiteActionsToolBar"
 GroupId="SiteActions"
 Localización="Microsoft.SharePoint.StandardMenu"
 Secuencia="100"
 Título="Ola!"
 Descrición="Acción menú personalizado engadido mediante unha característica."
    >
    <UrlAction Url="http://www.xyzzy.com"/>
  </CustomAction>
</Elementos>

That one took me a good two hours to figure out 🙂

I se consolar co feito de que, algún día no futuro, Eu vou ser capaz de dicir con convicción, "back in the day, Eu tiña que andar tres quilómetros de altura outeiro na neve (descalzo!) in order to deploy a custom feature to MOSS. You kids, non sabe como é doado tes que! Get off my lawn!"

Mal podo esperar.

</final>

Technorati Tags: ,

Blog Stats

I thought some people might be interested in my blog’s statistics. You can use mine as a benchmark to compare your own.

I’m running my blog on windows live spaces. They collect stats for me and I don’t know any way to control that. It’s good as far as it goes, but it’s fairly limited in that I can’t do much actual analysis with it. I’d love, por exemplo, to be able to generate a listing of my most frequently hit posts but I can’t do that without a prohibitive manual process. If someone knows better, por favor me diga.

Estado Live Spaces dicirme: hits total para o día, total hits for the week and total hits since day zero. It also tells me what people did to get to my blog (e.g. Google, MSDN enlace do foro, etc).

Nalgúns aspectos, a "hit" É obvio. Se estás lendo esta frase agora, vostede case certamente rexistrado como un único hit.

RSS is a little confusing. On one hand, I see individual RSS hits all day long. Pero, I also see RSS "sweeps". A sweep is when I see 20 ou 30 RSS hits all within a one or two second window. I assume these are automated things like google checking in on my site, navegadores quizais outros … non estou seguro. They are definitely some kind of automated process. I cannot tell, con todo, how many of my total hits are automated and how many have an actual human on the other side. I would guess at least 100 accesos por día son automatizadas.

En aos números!

Eu escribín o meu primeiro blog en 27 de xullo, 2007.

Escribín aproximadamente 60 entradas de blog, desde entón,, máis do que 50 que se relacionan directamente co SharePoint.

Comecei a seguir os meus acertos nunha folla nunha base diaria, a finais de setembro.

Comeza mensuais:

Primeira semana de: Total de Accesos
Outubro 1,234
Novembro 2,162
Decembro 3,071
Xaneiro 2008 4,253

Total por mes

Mes Total de Accesos
Outubro 6,620
Novembro 11,110
Decembro 13,138

Marcas de auga de alta

Tipo Total de Accesos
Best Day 958
Best Week 4,253
Total de Accesos desde o día cero 42,438

Estou interesado en outros’ stats. If you care to share yours in the comments, por favor, faga!

</final>

Technorati Tags:

Domingo Morning divertido: “Si, si, si. Blah, blah, bla.”

Preto de seis anos, os meus catro anos de idade, fillo e eu estabamos alí enriba asistir a unha Discovery Channel "shark attacks" especial (posiblemente esta). He was very young at the point and I was always worried what he might see on a show like this and how he might take it. I didn’t want him to develop, por exemplo, calquera medos especiais da auga ou tagarela algo impropio aos seus amigos e, finalmente, causar a súa rede de amigos bebé para derrubar.

Discovery handles these kinds of subjects very well. It’s not about creating a medo de algo, but rather to show how unusual it is for sharks to attack humans.

Así, we’re watching it and there is this one particularly scary attack involving a small girl. As Discovery is building the drama of the attack, meu fillo (que sempre foi moi axitado calquera maneira), is getting very excited. I make some noises about how unusual it is for sharks to attack people, and how bad the poor girl must feel. I’m trying to explain that people recover from these events and become stronger for it. Con todo, I had misinterpreted his excitement. He was not worried about the girl at all. Pola, mentres a aplaudir, el me di, "The sharks love it! It’s terrific. It’s wonderful. Its a DREAM COME TRUE!"

Eu pensaba que iso era Hilario, but also very disturbing. Por unha banda, Quedei contento — ata un pouco orgulloso — que podería ter fortes sentimentos de empatía, cross-species though they may be. As humans, we need to develop our "empathic muscles" para falar ou vai acabar como este cara 🙂 On the other hand, he was feeling cross-species empathy toward a species who was exhibiting behavior inimical to his own. I was really struggling with this when the narrator used the word "paradigm". My son picked up on that and asked me what that meant.

Isto non é unha palabra tan fácil de describir a un neno de catro anos, but I gave it a try. When I think of the word "paradigm", Thomas Kuhn is never far from my thoughts. I read A Estrutura das Revolucións Científicas de volta ao Lafayette e para mellor ou para peor, the word "paradigm" is pregnant with extra meaning for me. (Sort of like the word "contact" despois de escoitar unha voz Teléfono película me onde eu podía ver que dicir esta película [Eu penso que o libro era mellor]; Sempre digo para min mesmo, "CONTACT!" whenever I see or hear someone say "contact").

De calquera xeito, Estou tentando explicar a el unha definición kuhniana, that it’s "a historical movement of thought" and that it’s a "way of thinking with a number of built-in assumptions that are hard to escape for people living at that time." Por suposto, non se pode falar así dun neno de catro anos, so I’m trying to successively define it to smaller pieces and feeling rather proud of myself as I do so. (Eu só Sabía que alguén de fóra da facultade lle importaría que eu lera Kuhn!).

I’m just warming to the task when he interrupts me. Waving his hand na miña dirección xeral e nunca tirar os ollos doutro ataque de quenlla brutal, el só di, "Yeah, si, si. Blah, blah, blah.".

So much for that 🙂

Nese punto, Decidín fuxir, retoricamente fala, sentir-se, e divírtete asistir tiburóns atacan o ser humano co meu fillo.

</final>

Technorati Tags:

Cambiar Ver en base á identificación do usuario nun formulario do InfoPath

Nós tiñamos un país desenvolvido unha forma de InfoPath con varias exhibicións para apoiar unha nova contratación / on-boarding process. When the company hires a new person, o departamento de TI e outros grupos teñen que tomar medidas (configurar folla de pagamento, permitir o acceso a aplicacións axeitados, atopar un balcón, etc). We use on form but a different view of the form for each of those functions.

Nesta empresa, a maioría das persoas implicadas no proceso de negocio son IT-savvy, así cando acceder ao formulario, their default view is a "menu" view with buttons that direct them to their specific function. Con todo, we needed to simplify things for the new hire’s direct manager. This person should not see any of the IT related stuff. En realidade, debe ver só unha vista da forma e nin sequera ten a posibilidade de ver os outros puntos de vista.

No noso caso, que o relato de director directo está directamente ligada á forma como cortesía dun contacto co selector (which I am always wanting to call a "people picker" por algunha razón).

Os pasos son os seguintes:

1. No modo de deseño, vaia a Ferramentas -> Opcións de Formulario -> Abrir e Gardar.

2. Select "rules".

3. Create a new rule whose action is "switch to view" e cuxa condición aproveita o nome de usuario() función.

Nome de usuario() returns the "simple" user name without the domain. If I log into SharePoint with credentials "domain\pagalvin", Nome de usuario() returns "pagalvin".

The contact selector provides three bits of information for a contact. The "AccountID" portion is most useful for this scenario. The only thing that makes this even a little bit of challenge is that the contact selector (no meu ambiente de calquera maneira) devolve o dominio e ID de usuario, as in "domain\pagalvin". This prevents us from doing a straight-forward equality condition since AccountID ("domain\pagalvin") nunca será igual usuario() ("pagalvin").

We can get around this using the "contains" operador: AccountID contén usuario().

Podemos ir máis aló e pre-pende dun dominio hard-Coded diante do nome do usuario() función para comprobar a nosa igualdade e eliminar o risco dun falso positivo do operador contén.

We would have REALLY like to automatically switch view for other users based on their AD security group membership. Por exemplo, when a member of the "IT Analytics" grupo accede ao formulario, automatically switch to the IT Analytics view. We didn’t have time to implement it, but my first thought is to create a web service that would have a method like "IsMemberOfActiveDirectorySecurityGroup", pasalo a usuario() and return back true or false. Does anyone have any other, idea máis intelixente? Is there any SharePoint function we can leverage from InfoPath to make that determination?

</final>

Technorati Tags:

Accidentalmente Engadido código para unha forma de InfoPath; Eliminar-lo deliberadamente

Ao traballar con botóns nun formulario, we often add rules. You access the rules editor from the properties of the button.

Ao premer en volta rapidamente, it’s easy to accidentally click on "Edit Form Code" instead of "Rules …".

A primeira vez que fixen este, I canceled out of the code editor. Con todo, cando intento publicar o xeito un pouco máis tarde, it required that I publish as an "Administrator-approved form template (avanzado)". I didn’t actually do any programming and I absolutely didn’t want to go through an unnecessary approval process. I was in a bit of panic at the time due to time constraints. To get past it, I simply restored a previous backup and continued. I had recently seen some blog posts about people going into the form’s XML to tweak things and I was afraid I would have to do something similar.

Hoxe, I did it again. Este tempo, Eu tiña un pouco máis de tempo nas miñas mans e descubrín que pode facilmente desfacer esta.

Ir a:

Ferramentas -> Opcións de Formulario -> Programación: "Remove Code"

Ela non queda moito máis fácil do que.

</final>

Technorati Tags: ,