નામ બદલી વેબ ભાગ નેમસ્પેશીસ (અથવા, આ પૃષ્ઠ પર "વેબ ભાગ અથવા વેબ ફોર્મ નિયંત્રણ માટે એક કારણ દર્શાવવામાં અથવા આયાત કરી શકાતી નથી)”

હું પાછા મારા દેવ ગાલ વિચાર કામ કરે છે અને તે માટે કરવામાં આવ્યા છે, નીચેના બીટ્સ હોય છે કે જે એક હોબી પ્રોજેક્ટ પર કામ:

  • બોક્સ શેરપોઈન્ટ લખાણ ફિલ્ટર વેબ ભાગ એક બહાર એક સાઇટ અથવા સાઇટ સંગ્રહ URL ને મેળવે છે કે વેબ ભાગ કનેક્ટેડ.
  • This web part looks up all the info about the the selected site, generates an XML package and hands it off to another WP on the page (via connections).
  • 3rd web part receives the XML and does some XSL transform stuff.

I wanted to rename the name space of all the bits to “Nivlag” and I was getting hit up with the following error when I deployed the web part to  my test environment:

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.

This is a beginner’s problem but I thought I’d jot down a note on this anyway.  I caused the error when I right-clicked on the default name space (which defaulted to the project name), selected Refactor and then Rename like so:

image

That did rename things in a bunch of places in the project, but it’s not enough.  You also need to make several other adjustments:

1. Manually open up and edit a file, “ShaerPointProjectItem.spdata”. That an XML file that has a <SafeControls> section.  The namespace rename function isn’t aware of this file for whatever reason, so you need to update the Namespace there manually.

2. Manually edit the .webpart file.  For whatever reason, Visual Studio doesn’t change this reference either.  Change the "<પ્રકાર>” node to reflect your changed namespace there.

3. આખરી વખતે, depending on how you refactored the namespace change, visual studio may have also updated the string that references your .ascx file here:

private const string _ascxPath = @"~/_CONTROLTEMPLATES ……

You may need to change that back.  You’ll because you’ll get an error similar to the following when you try and add the web part to a web part zone on a  પાનું:

Server Error in ‘/’ અરજી.


The file ‘/_CONTROLTEMPLATES/Nivlag/VisualWebPart1/VisualWebPart1UserControl.ascx’ does not exist.

વર્ણન: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The file ‘/_CONTROLTEMPLATES/Nivlag/VisualWebPart1/VisualWebPart1UserControl.ascx’ does not exist.
સોર્સ ભૂલ:

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.

 

Fix the reference there and you should be good to go.

4. આખરી વખતે, the actual ASCX file still had a reference (for me) to the old original namespace (the refactor/rename function didn’t fix this).  You’ll know about this error when you try and add the web part to the page and get the following message:

Server Error in ‘/’ અરજી.


પાર્સર ભૂલ

વર્ણન: એક ભૂલ આ વિનંતી સેવાઓ માટે જરૂરી સાધન ના પદચ્છેદન દરમિયાન આવી. નીચેના ચોક્કસ parse error વિગતો રીવ્યુ કરો અને યોગ્ય તમારી સ્રોત ફાઇલ સંશોધિત કરો.
પાર્સર ભૂલ સંદેશો: Could not load type ‘RenameNameSpace.VisualWebPart1.VisualWebPart1UserControl’.
સોર્સ ભૂલ:

રેખા 6:  <%@ Import Namespace="Microsoft.SharePoint" %> 
રેખા 7:  <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=14.0.0.0, સંસ્કૃતિ = તટસ્થ, PublicKeyToken = 71e9bce111e9429c" %>
રેખા 8:  <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="VisualWebPart1UserControl.ascx.cs" Inherits="RenameNameSpace.VisualWebPart1.VisualWebPart1UserControl" %>

સ્રોત ફાઇલ: /_CONTROLTEMPLATES/RenameNameSpace/VisualWebPart1/VisualWebPart1UserControl.ascx    રેખા: 8


આવૃત્તિ માહિતી: માઈક્રોસોફ્ટ. ડોટ નેટ ફ્રેમવર્ક સંસ્કરણ:2.0.50727.4927; ASP.NET સંસ્કરણ:2.0.50727.4927

Edit the .ascx file directly and fix the broken namespace.

આ બિંદુએ, I finally had a web part living in the namespace of my choosing.

</અંત>

મારા બ્લોગ પર સબ્સ્ક્રાઇબ કરો.

Twitter પર મને ખાતે અનુસરો http://www.twitter.com/pagalvin

વન પર વિચાર્યું "નામ બદલી વેબ ભાગ નેમસ્પેશીસ (અથવા, આ પૃષ્ઠ પર "વેબ ભાગ અથવા વેબ ફોર્મ નિયંત્રણ માટે એક કારણ દર્શાવવામાં અથવા આયાત કરી શકાતી નથી)”

  1. Pingback: Tweets that mention Renaming Web Part Namespaces (અથવા, આ પૃષ્ઠ પર "વેબ ભાગ અથવા વેબ ફોર્મ નિયંત્રણ માટે એક કારણ દર્શાવવામાં અથવા આયાત કરી શકાતી નથી)” « Paul Galvin's SharePoint Space -- Topsy.com

જવાબ છોડો

તમારું ઇમેઇલ સરનામું પ્રકાશિત કરવામાં આવશે નહીં. જરૂરી ક્ષેત્રો ચિહ્નિત થયેલ છે *