I just wrote a new web part and now I am getting this error when I try to deploy them on my non-dev servers:
the default namespace
'http://schemas.microsoft.com/WebPart/v2'
is a reserved namespace for base Web
Part propertiees. Custom Web Part
properties require a unique namespace
(specified through an
XmlElementAttribute on the property ,
or an XmlRootAttribute on the class).
I am writing the web parts into CAB files and deploying them with this:
stsadm -o addwppack -filename web_part_name.CAB -url http://your_url_here -globalinstall -force
Everything works fine until I try to add the web part, then I get this error in a popup. It works just fine on my dev VM...?
Any ideas would be appreciate, thank you.
Well, it looks like your webpart definition file si somehow broken. The wey i do it is to put webpart into page and then export it. You can do this just by opening webpart galery, which can be located in site settings of root site collection and add your webpart there.
After that just place webpart to any page and use export button in webpart settings. This will produce .webpart or .dwp file depending on your webpart (.webpart is 'new' definition which is used by webparts native to MOSS 2007 and .dwp is for older webparts, but it depends how you have written your webpart)
Then just take exported file and include it into your project. This approach works for me at least.
Did you package your webpart as a .webpart file ?
If this is the case, you have to use the new v3 namespace. To use the v2, you have to package it as a .dwp file.
Yes, your web part definition file (*.dwp or *.webpart) is probably not correct. Post it here, and it should be swift to find the error.
A bit of a educated guess here but anyway :-
First check that you have XmlRoot attribute like this in your web part
[XmlRoot(Namespace = "Your.Namespace")]
public class YourWebPart: WebPart
{
...
and XmlElement attribute on your custom properties
[DefaultValue(0)]
[WebPartStorage(Storage.Shared)]
[Browsable(false)]
[XmlElement(ElementName = "YourProperty")]
public Int64 YourProperty
{
...
}
This error is happening when .NET is attempting to desterilize the data from the .DWP file and set the custom properties in your web part.
I suspect that the error may have nothing to do with namespace conflicts as SharePoint sometimes tends to fall back to an error messages that can be a red herring.
I would firstly examine your .dwp file. Do you have any custom properties set there, if so remove them and retest.
Comment out the custom properties in your web part code one by one and retest at each step.
I think you will find one of these is causing the problem - exactly why is the next question!
Related
Working on a system and need to update a WCF service. The issue I am having is that the service file is a .map file. Using Visual Studio I would have assumed that I could just right click it from solution explorer and update the service from there, but there is no such option.
The .map file itself is an xml containing the Service endpoints and what not. It is also grouped with (could be a plugin "VScommands" that did this grouping) a .cs file of the same name containing the auto-generated code to use the service.
I'm unsure what other information I should provide but if someone could point me in the right direction it would be much appreciated.
So to get around this issue I had to manually enter in the inforamtion I needed. Did this by using the svcutil.exe tool provided by microsoft.
Real late update, decided to just remove the entire service reference and re-add it.
I created a WCF service (the regular templete one) and tried to access the service. after that everything was fine. after i renamed (using refactoring the name of IService and Service) OSDataService and IOSDataService i got the following error while accessing the srv file :
how can i rename it without getting this error?
i tried also changing it in the web.config file and still the same problem.
Anybody had this problem?
You have to view the markup of the service file and change this in the directive to be the new name because it doesn't change automatically
Right click on the service name, then chose "view markup" and then change the "Class" attribute to be the new name.
Do you have a .svc-file? Have you updated the markup in that file if you have one?
Do a search in the whole solution after the old service name and you will moste likely find the file that need to be updated.
Well solved it:
you need first to rename the Iservice on the solution explorer, then refactor the service and refactor again all the data (VS2010 will tell you what to do) only then rename the service name (on the solution explorer)
You must update the reference in the client. Or update the stubs manually, but I wouldn't recommend that.
I am having problems gaining access to a clients web service online.
If I have the wsdl file, can I do "something" in VS2010 with it so I can add it as a reference and start my C# coding?
Thanks Paul
When you go to "Add Service Reference", the textbox that allows you to enter a URL, can also take a path on your local filesystem to a wsdl.
Additionally, while not the optimal route, you can also use the wsdl.exe/svcutil.exe utility (bundled with VS) to generate a proxy class. Adding a reference is the better way to go, but this is an additional option.
Adding the Service Reference as a local path worked for me like a charm. I would have voted +1 for xelco52, but my rep is too low...
Only 1 issue; one of my members of the class I've added does not work. I wonder if I need to use the sledgehammer...?
If you have the WSDL file, under one of your projects in VS, right-click the References project folder and choose Add Service Reference. Click the Advanced button, and in the new dialog click Add Web Reference. Now, go find the WSDL file, either where you saved it or where you downloaded it, enter its location in the textbox, and click Go. VS will digest the WSDL and produce a class that is the service client, and others as necessary to implement custom types accepted by the service.
It's usually a good idea, if you have downloaded the WSDL, to include it as an item in the project that has the web reference; that allows it to be easily traversed as a reference source, and to be located should you need to recreate the web service classes.
I have changed my app name and namespaces as well from FooXXX to FooYYY.
VS applied changes to all files. I've checked all namespaces, names etc, project compiles but when I want to deploy it to emulator or to a device it crashes straight away. No warring, no message, no exception. Only spash screen is shown and then OS gets back to start screen.
I made a copy of this solution and I've changed all names, namspaces again and now app compiles and deploys, but I have two messages:
Message 2 Could not find schema information for the element 'http://schemas.microsoft.com/client/2007/deployment:Deployment.Parts'.
Message 1 Could not find schema information for the element 'http://schemas.microsoft.com/client/2007/deployment:Deployment'.
Any clue what casuses the crash?
Check the "Startup Object" in the project properties page. The sometimes requires manually being set/corrected when the namespace of the app is changed.
I had the same problem but it was due to the WCF RIA Services link.
In the project properties change the WCF RIA Services link to
Save and close the tab
Change to the previous link
Save
I got a problem like this and it was a problem inside WMAppManifest.xml file under Properties. Look at the TokenId, default page etc...
To resolve this, I actually just restarted VS2012.
Hello guys I think the question i asked in the previous post is unclear OK fine. i am explaining in brief.
for example.
I have a form where i have placed one textbox and command button.
I have fired a event when i click the button the text under the textbox change to "hello" ok fine.
what is my problem is..
the application is created and I published ok.
After some week I thought I want to update my application. where in the place of "hello" I want "hi". I know that we can compile the whole project and publish it.
but I don't want my whole application to be updated.
for example.
What antivirus company do they have a definition file where they only update the definition file not the whole application. after the update it applies to whole application.
I want my application also to do same process like antivirus company do.
You should read that "Hello" from a content file (XML). Then you can just push out the new file.
Use a configuration file. You can add an application.config (or if you're developing a web app, web.config) file to your primary project. Within this configuration file, you can define AppSettings (which are built-in, usually simple and atomic string or number fields that the application will need), ConnectionStrings (which specifically provide information applications will need to connect to a database), or custom configuration sections (used for more complex, related sets of data that are loaded into custom classes you define, such as a basic company profile). Within your code, you access AppSettings by using the static ConfigurationManager.Appsettings[] collection; you tell it the name of the setting you defined in the file, and it returns the value (or null, if it can't find the setting you defined).
Related, but different, is the use of Resource files. Resource files usually contain a dictionary of location-specific data used by the UI, such as text strings, icons and images. Actual resources can be compiled into one big file, or resource files can be a list of paths and filenames to the actual resources. You can use resource files to create different "skins" for your application to be used by different companies by referencing images to use for UI elements, or to translate labels and other text on your application's UI. Resource files are accessed through a ResourceManager; you tell it where the resource file is, and it will load the information into a similar "dictionary"; you then tell it the name of the resource and you get the resource back.
For your specific question, I'll answer the same thing as Henk. But, I think that your real question is "How I do create patch in .NET".
You can check this link:
How can I patch .NET assemblies?
You could design your application to use plugins. This way you only have to update a plugin and not the whole application.
if you want to create a patch for asp.net application , first of all , you have to deploy your project with Web Deployment Project.
then choose Create a separate assembly for each page and control output in output assemblies tab and re-build your solution .
the result of deployment is bunch of DLL which mapped to each page or control.
Now if you changed one page's data (in code behind) , you need to deploy your project again but in this case you can just upload the changed dll file.