Renaming Web Part Namespaces (Los sis, Ib tug tos rau "ib cov qhov Web site Web daim ntawv tswj ntawm nplooj ntawv no ua tsis tau raug tso tawm kom pom los mas)”

Kuv twb tau ua hauj lwm kom tau kuv tus dev npuas rov qab thiab rau qhov tus kawg, ua hauj lwm nyob rau ib qhov project hobby uas muaj cov khoom nram qab no:

  • Connected web qhov uas nws tau txais ib qhov chaw los yog qhov chaw sau URL ntawm ib qho tawm ntawm lub thawv rau cov qhov Web site SharePoint ntawv nyeem lim.
  • Web site qhov no zoo li cov info qhov tus kawm ntawv xaiv, generates ib lub pob XML thiab ob txhais tes nws tawm mus rau lwm lub WP nyob rau sab (ntawm kev sib txuas).
  • 3cov qhov Web site lawm tau txais hauv XML thiab puas muaj ib co XSL txia khoom.

Kuv xav rename qhov chaw sau lub npe ntawm tag nrho cov kev khoom rau cov "Nivlag" thiab kuv twb tau ntaus nrog rau qhov yuam kev li nram no thaum uas cov qhov Web site rau deployed kuv  Kuv lub chaw kuaj:

Ib cov qhov Web site Web daim ntawv tswj ntawm nplooj ntawv no ua tsis tau raug tso tawm kom pom los mas.  Cas yuav tsis nyob los nws yuav tsum tsis zwm zoo li.

Qhov no nws yog ib tug beginner teeb meem tab sis kuv xav tias kuv xav jot cia ib tug faj seeb rau hauv no lawm.  Kuv mob qhov yuam kev no thaum kuv nyob rau lub neej ntawd lub npe chaw right-clicked (uas txog qhov project npe defaulted), Parent Refactor thiab Rename ntawd nyiam li ntawd:

image

Uas cas rename yam uas nyob hauv ib Rev qhov chaw nyob rau hauv peb tes num, tiam sis nws muaj tsis txaus.  Koj kuj tau mus ua ob peb lwm yam kev kho me ntsis:

1. Manually qhib thiab hloov tau ib tug ntaub ntawv, "ShaerPointProjectItem.spdata". Tias ib XML tau thov uas muaj ib tug <SafeControls> seem.  Tsis ras paub txog cov ntaub ntawv no txawm vim txoj kev ua namespace rename, li ntawd, koj yuav tau hloov cov Namespace muaj manually.

2. Qhov ua ntaub ntawv thov .webpart hloov manually.  Txawm vim li, Nrig txog kev pom Studio tsis hloov no siv yog.  Kev hloov cov "<hom>"ntawm kom muaj kev cuam tshuam koj hloov namespace muaj.

3. Ntsig, nyob ntawm seb koj refactored namespace hloov, siv qhov muag saib lub studio kuj muaj tseem tshiab txoj hlua references koj thov no los .ascx li no:

chaw const txoj hlua _ascxPath = @"~/_CONTROLTEMPLATES...

Koj yuav tau hloov ntawd rov qab.  Koj mam li vim koj mam tau txais ib qho kev ua yuam kev xws li nram no thaum koj mus sim thiab ntxiv rau cov qhov Web site kom zoo noj qhov Web site ntawm ib  nplooj ntawv:

Neeg rau zaub mov yuam kev hauv ' /’ Daim ntawv.


Cov ntaub ntawv ' /_CONTROLTEMPLATES/Nivlag/VisualWebPart1/VisualWebPart1UserControl.ascx’ tsis muaj nyob.

Hauj lwm lawm: Kev unhandled zam tshwm sim thaum tus tiav thov web tam sim no. Thov xyuas Tshooj ib txoj lw kom paub ntau ntxiv txog cov kev ua yuam kev thiab qhov twg nws originated hauv qhov chaws.
Kos paub meej: System.Web.HttpException: Cov ntaub ntawv ' /_CONTROLTEMPLATES/Nivlag/VisualWebPart1/VisualWebPart1UserControl.ascx’ tsis muaj nyob.
Qhov yuam kev:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

 

Txhim kho qhov siv muaj thiab koj yuav tsum tau kom mus zoo.

4. Ntsig, ASCX ntawv nqi tseem tshuav ib tug siv (rau kuv) rau cov qub thawj namespace (txoj kev ua refactor/rename tsis txhim kho qhov no).  Koj mam li paub txog cov no yuam kev thaum koj sim thiab ntxiv rau cov qhov Web site ntawm nplooj thiab tau txais cov lus nram qab no:

Neeg rau zaub mov yuam kev hauv ' /’ Daim ntawv.


Parser kev ua yuam kev

Hauj lwm lawm: Ib qho kev ua yuam kev tshwm sim thaum lub caij cov parsing hauv ib qho chaw uas yuav tsum tau muab cov kev pab no thov. Thov nyeem qhov nram qab no parse kev yuam kev txhawb thiab hloov koj cov ntaub ntawv twg paab.
Lus sam yuam kev parser: Yuav tsis ntsaws hom 'RenameNameSpace.VisualWebPart1.VisualWebPart1UserControl'.
Qhov yuam kev:

Kab 6:  <%@ Ntshuam Namespace="Microsoft.SharePoint" %> 
Kab 7:  <%@ Register Tagprefix = "WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version = 14.0.0.0, Culture = nruab nrab, PublicKeyToken = 71e9bce111e9429c" %>
Kab 8:  <%@ Tswj lus = "C#" AutoEventWireup = "nws muaj tseeb" CodeBehind="VisualWebPart1UserControl.ascx.cs" Inherits="RenameNameSpace.VisualWebPart1.VisualWebPart1UserControl" %>

Tau qhov twg los thov: /_CONTROLTEMPLATES/RenameNameSpace/VisualWebPart1/VisualWebPart1UserControl.ascx    Kab: 8


Cov ntaub ntawv Version: Microsoft .NET moj khaum Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

Kho kom raug .ascx ntawv ncaj qha thiab txhim kho tus namespace lawm.

Thaum no tus taw tes, Kuv thaum kawg muaj ib feem nyob hauv cov namespace uas kuv xaiv Web site.

</kawg>

Subscribe rau kuv blog.

Raws li kuv nyob Twitter tom http://www.twitter.com/pagalvin

Ib tug xav rau"Renaming Web Part Namespaces (Los sis, Ib tug tos rau "ib cov qhov Web site Web daim ntawv tswj ntawm nplooj ntawv no ua tsis tau raug tso tawm kom pom los mas)”

  1. Pingback: Uas pav Renaming Web Part Namespaces tweets (Los sis, Ib tug tos rau "ib cov qhov Web site Web daim ntawv tswj ntawm nplooj ntawv no ua tsis tau raug tso tawm kom pom los mas)Chaw "«Paul Galvin SharePoint sau -- Topsy.com

sau ntawv cia

Koj email chaw nyob yuav tsis muab luam tawm. Search cim *