Question

web part development

Asked by: mirthless

I am using .net studio 2003 to develop web parts for Share Point Services.  After I build the solution for my project, I place the .dll file in the \inetpubwwwroot\bin directory; place it in the GAC and make a "Safe Control" entry in the web config.  All is well, my web part is accessing data from an SQL database and depicting it nicely in a grid.  Now, I need to make an adjustment to the project and rebuild the .dll file in the bin directory.  The new .dll is written in the appropriate location, but sharepoint is still showing the old version of the web part.  What do I have to do to be able to update these .dll files?

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2005-06-24 at 12:22:23ID21470112
Tags

sharepoint

,

web

Topic

MS SharePoint

Participating Experts
1
Points
500
Comments
13

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Develop web part with visual studio 2005 for sharepoint
    Hi, I have installed visual studio 2005 in a server where sharepoint server 2007 is installed.I aslo installed visual studio 2005 extensions for windows sharepoint services 3.0 version 1.1. Even after installing all these,i am not able to see a webpart template when i select...
  2. Silverlight in the GAC?
    I have tried to get a Silverlight web part to work in SharePoint, but each time I add the web part to the page, I get the SharePoint error message. Here's the tutorial I just followed: http://blogs.msdn.com/andreww/archive/2009/03/12/silverlight-web-part-in-sharepoint.aspx ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: _TAD_Posted on 2005-06-24 at 14:56:30ID: 14297576


1) reboot the webserver

OR

2) Change the version of your dll.  SharePoint will always use the highest version available.

 

by: _TAD_Posted on 2005-06-24 at 14:58:15ID: 14297582

I would also suggest using a CAB file project for installing web parts.  it is much more clean and easier to maintain!

Here is a document I created for my team on web part development.  It's a bit overkill for this question, but you may find it useful.


<--------------->




Abstract
     SharePoint is a very robust web application with many feature-rich stock components known as “web parts ”.  These web parts (many provided by Microsoft) can do a great many things, but they cannot be “everything-to-everybody”.  Because of this, Microsoft has allowed its customers to create their own web parts using the exact same API  that Microsoft used to create SharePoint.   The rest of this document will briefly go over a few basic methods for creating, installing and testing web parts; focusing mainly on the creation of web parts from within VS.Net   2003 (Microsoft’s preferred IDE ).
     There are a few steps that need to be done before a web part can be built.  (1) The programmer will need to download the Microsoft.Sharepoint.dll file and register it in their global assembly cache (GAC ).  (2) The programmer will need to download and install SharePoint’s .Net SDK  (wssSdk.exe ).  (3) Finally, the developer will need to download and install Lutz Roeder's .Net Reflector program.



 
Development
Pre-Development
1.     Download and register Microsoft.Sharepoint.dll into the GAC
2.     Download and install the wsssdk.exe
3.     Download and install Lutz Roeder's .Net Reflector program.

Development Steps
1.     Using Visual Studio.Net, create a new SharePoint Web Part Project (wssSDK should have added this option to your Visual Studio Project Manager.
2.     Include reference to Microsoft.sharepoint.dll
3.     Using the sn.exe  command line utility create a KeyPair.snk file
4.     Include a CAB  project into your web part solution
a.     Include Primary Output
b.     Include Content Files
c.     Include KeyPair.snk
d.     Include other files (e.g. resX , gifs , etc)
Note: make sure that the CAB project is a dependent of the web part project
5.     Edit the AssemblyInfo.cs class, change AssemblyVersion(“1.0.0.1”)
6.     Use Lutz Roeder's .Net Reflector  to get the PublicKeyToken ID
7.     Edit the DWP file to include assembly information (e.g. <Assembly>MyWebPartProjectName, Version=1.0.0.1, Culture=neutral, PublicKeyToken=d2d0ae92999983bd</Assembly>
a.     The Assembly name [MyWebPartProjectName] is case sensitive and MUST match the compiled dll name exactly.  
b.     The entire contents of the <Assembly> tags can be copied and pasted from the .Net Reflector program
8.     The version number in the dwp file MUST match the version in the AssemblyInfo.cs file exactly.

Development Notes
1.     All public properties will be serialized and be part of the tool parts property pages.
2.     Public properties should be of the following types: String, Enumeration, Boolean, Date or Numeric.
Property Type     Displays as
String     Text Box
Date     Text Box
Numeric     Text Box
Boolean     Check Box
Enumeration     Drop Down List

 

3.     Each public property should have the following attributes:
Attribute Name     Attribute Resultant
Browsable(<true/false>)     - Displays the property in the tool pane (true or false)
Category(<Text Value>)     - Determines which category this property will appear under.
- If no category is provided, Miscellaneous will be used
- If the entry matches categories that already exist (Advanced, Layout, etc), the entry will be ignored and Miscellaneous will be used.
DefaultValue(<variable>)     - Required for proper initialization
WebPartStorage
(<storage enum value>)     - Determines who sets the value (shared is set by admin, personal is set by user)
FriendlyName(<Text Value>)     - This is the title of the property and it will show up as a label on the tool property pane.
Description(<Text Value>)     - This is the information that will display in the tool tip dialog

4.     Each property should be dependent on two defined variables.  The first is a constant which defines the default value (<private const string defaultVarValue>). The second is the variable that will store the value of the data entered (<private string varValue>).








 
Installation

1.     Copy the recently compiled CAB project to a directory on the SharePoint web server (must be placed on both production web servers).
a.     We are currently storing all of the CAB projects in the following directory:
\\<web server>\Program Files\Common Files\Microsoft Shared\web server extensions\60\WPPACKS

2.     Installing the web part can be as easy as right-clicking the CAB project and “Install Web Part”, or by using the stsadm.exe program (the right-click option is a custom batch program developed by T.Degen)
3.     Using the command line utility stsadm.exe found at: C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\BIN perform the following commands
a.     Add Web Part: stsadm -o addwppack -globalinstall -force -filename C:\<path>\<Cab Project Name>.CAB
b.     Delete Web Part: stsadm -o deletewppack -name <Cab Project Name>.CAB


 
Testing

Task      
     
Verify that you can add the Web Part properly to a Web Part zone.
     
Verify that static Web Parts render appropriately and do not cause the Web Part Page to fail.
     
Verify that the Web Part works correctly regardless of where the Web Part Page is located.
     
Verify that property attributes are correctly defined.
     
Verify that Web Part changes made in personal view are not reflected in shared view.
     
Verify that every public property can handle bad input.
     
Verify that the Web Part handles all of its exceptions.
     
Verify that the Web Part renders correctly in Microsoft Office FrontPage.
     
Verify that Web Part properties displayed in the tool pane are user-friendly.
     
Verify that the Web Part appears appropriately in the search results.
     
Verify that you can import and export the Web Part properly.
     
Verify that the Web Part previews properly.
     
Verify that the Web Part can access its resources in different setup configurations.
     
Verify that Web Part properties are not dependent on each other.
     
Verify that Web Parts work correctly with different combinations of Web Part zone settings.
     
Verify that the Web Part renders appropriately based on user permissions.
     
Verify that adding several instances of the same Web Part to a Web Part Page (or in the same Web Part zone) works correctly.
     
Verify that Web Part caching works correctly.
     
Verify that requests to other HTTP sites or Web services are asynchronous.


Original Source:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/Office_SharePointWebPartsTestingChecklist.asp

 
Appendix

SharePoint Developer to Developer
http://msd2d.com/

Introduction to Web Parts
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/sharepoint_modifyingui.asp

Building a Basic Web Part
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/CreateWPToolPart_SV01003711.asp

Web Part Design Considerations
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/modcore/html/deconguidelinesforbuildinggoodwebparts.asp

Advanced Web Part Design
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/sharepoint_modifyingui.asp

Deploying Web Parts
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_SP2003_ta/html/sharepoint_deployingwebparts.asp

 

by: mirthlessPosted on 2005-06-27 at 08:50:17ID: 14309903

This issue is still not resolved.  After following all of the above suggestions, making a CAB file, rebooting server, resubmitting the cab file with -force (this places the lates 'dll file on the server).  All changes after the first submission are not reflected.  This is not much use to me if I cannot update dll files and have them reflected on the sharepoint server.

Any help is appreciated.

 

by: _TAD_Posted on 2005-06-27 at 08:59:42ID: 14310026


You can try resetting your IIS server (Start> Run> IISRESET), but this will shut down your IIS server for about a minute.

If rebotting the IIS services did not help, then your new dll is not properly registered in the GAC or is not specified in the Web.Config file correctly.

How many web servers do you have in your farm?  You need to keep in mind that this new dll has to reside on ALL web servers in your farm as well.

 

by: mirthlessPosted on 2005-06-27 at 11:54:02ID: 14311822

IIS reset has been tried.  It is in the web config.  It is not a problem with being a "Safe Control".  The issue is after re-uploading a new .dll file, the web part still looks like the old one.

I am working on a single server development server.

I also had to use the .net configuration tool to give rights to my .dll file to actually query the SQL server database.  Is there some type of waiting period that these changes may propogate?  Is there some service I need to stop and restart?

 

by: _TAD_Posted on 2005-06-27 at 12:02:09ID: 14311896


>> Is there some type of waiting period that these changes may propogate?  Is there some service I need to stop and restart?

No, and no... You see what is odd is that it sounds like you've done everything right.

At the risk of insulting your intelligence, here's the list of steps that need to be done from start to finish.  Perhaps you simply overlooked one of the early steps and now it's causing you grief.

1) Create a web part (use the cab project scenario I provided above, it makes it easier in the long run).

2) Install the cab project using stsadm tool

3) add the web part to a page somewhere

4) Alter web part source code, change the version number in 2 places and compile

5) Uninstall current (now defunct) web part

6) Install the new and improved web part.

7) re-add the web part to the page and view it.




 

by: _TAD_Posted on 2005-06-27 at 12:04:48ID: 14311914

Install web part
stsadm -o addwppack -filename C:\temp\MyWebPart.dll -globalinstall -force

uninstall web part
stsadm -o deletewppack -name MyWebPart

 

by: mirthlessPosted on 2005-06-27 at 12:19:59ID: 14312052

I had been missing trying the uninstall and version changes.  I accomplished both and still no go....any other ideas?  My intention here is to be able to upload a web part make it available to my users and then be able to update the web part without having to remove it from all of the pages it has been added to and readding for each version.  Is this something that should be do-able?

 

by: _TAD_Posted on 2005-06-27 at 12:40:13ID: 14312234


If you change the version number then you need to remove the web part from each and every page and re-add it.

If you keep the same version number, then you need to do an IISRESET for the new version to take affect.

This is, of course, after you perform the un-install and then install the new dll.

 

by: mirthlessPosted on 2005-07-21 at 07:20:10ID: 14493575

OK All,  I have the definitive answer for my problem.  If I place the .dll in the GAC, it requires an IIS reset every time I update the .dll.  Each time I want to update the web part, this requires deleting the .dll from the GAC and placing the new .dll in the GAC, then IISReset again for the update to kick in.

Simpler method is to do the following.

Make sure that the .dwp file is clean and simple.  If a public key token is in the .dwp file, sharepoint is going to look in the GAC which requires iisreset.  You want the .dll in the bin without any reference to the bin.  Make sure to change your security level as needed, most web parts that do anything other than display links or info. (query anything) require at least medium trust.

 

by: _TAD_Posted on 2005-07-21 at 11:44:04ID: 14495997

You can avoid the IISRESET if you change the version number of the webpart.  But then, of course, if the web part is in use, it is now broken.  

I still would not recommend using your "simpler method".  The high level of security is there for a reason.  typically web servers reside in a DMZ so the outside world can access them.  By lowering the trust level you are increasing exposure and risk.


The 30 seconds it takes to perform an IISRESET highly outweighs the level of risk you are accepting by lowering the trust level.

 

by: mirthlessPosted on 2005-07-21 at 11:53:33ID: 14496112

Problem is.......if business rules change, then web parts must change with them.  If the web part has been placed on 50 - 100 pages...redeploying webparts becomes unbearable.  Two choices here, place it in GAC then iisreset continually or place in bin with a medium trust level.

The only way I see it is either place the .dll in the GAC = full trust or place dll in the bin = medium trust....

My need here is to able to update a webpart easily but keep the trust levels at a minimum.  I suppose if I placed the .ddl in the GAC I would only be allowing each individual webpart to be fully trusted.  Perhaps this is better than allowing medium trust for the entire site.  As it is for now though, my web server is not open to the outside world except through vpn or terminal server access.  I am also trying to get a custom trust policy working.  Perhaps someone has actually done this and can enlighten me.  I have used the MS writeups to no avail so far.

 

by: _TAD_Posted on 2005-07-22 at 14:33:42ID: 14507027


Personally, I have opted for the IISRESET option.  Sure the web site is down, but only for about 30 seconds.  I guess our production web parts just don't change often enough for me to be concerned about an iisreset.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...