Showing posts with label SharePoint. Show all posts
Showing posts with label SharePoint. Show all posts

Friday, April 30, 2010

Working with the build in SharePoint web services

I’ve started to play a bit with the build in web services in SharePoint…to be completed…I’ll just throw in some notes along the way for now…

Manually generating a proxy class instead of using the one Visual Studio ‘Add reference’ generates which has hard coded default values for the web service endpoint.

wsdl.exe http://servername]/_vti_bin/SiteData.asmx /l:cs /n:Webifiera.SharePoint.WebService.API.GeneratedProxies /o:c:\temp\SiteDataWS.cs /u:Administrator /p:PasswordGoesHere /d:DomainGoesHere

Tuesday, April 27, 2010

Windows Installer doesn’t finish determining disk space requirements

I typically run into this problem when installing VSwWSS v1.3 (Visual Studio 2008 extensions for Windows SharePoint Services 3.0) on virtual machines, and each time I need to crawl Google to find the right solution "out there".
Some of the suggested solutions I've found are:

  • Run the VSeWSSv13_x86_Feb2009CTP_Build_429.exe as Administrator and it will work
  • Extract the .msi file from the .exe using the command VSeWSSv13_x86_Feb2009CTP_Build_429.exe /extract ./
    and then run the .msi file from the command-prompt using the command
    msiexec /i VSeWSSv13_x86_Build-429.msi
None of them works for me, but the second suggestion is on the right path...
Solution that works:
  1. Extract the .msi file from the .exe using the command
    VSeWSSv13_x86_Feb2009CTP_Build_429.exe /extract ./
  2. Run the .msi file from the command-prompt using the command
    msiexec /package VSeWSSv13_x86_Build-429.msi /qr

MsiInstallerProblem

Voila!

Tuesday, March 30, 2010

FxCop support for SharePoint specific issues

Doing SharePoint development and a fan of FxCop for code analysis?

Make sure you have these set of SharePoint specific rules added:
It currently supports 19 different rules, most of them related to IDisposeable-patterns.

Continually running FxCop agaist your code during development (see this post on how to integrate it into Visual Studio) and prior release running SPDisposeCheker on all assemblies should prevent you from hitting most memory leak issues (and as a bonus you will discover other possible issues in your code that FxCop points out)

Monday, March 29, 2010

SPDisposeChecker - Avoid memory leak patterns in your code

There are a number of rules and best practices when it comes to developing against the SharePoint API.
Here's a bunch of them:


No matter how well you know these rules there are times when your brain will temporary forget about them. There are also scenarios that can be a bit tricky to recognize as a "dispose scenario".
One example of the latter is when using the indexer on a SPSiteColletion for instance, see this article for details:
One great thing about being a developer on the 20th century (apart from the Internet - thank you mr Lee!) are the Open Source projects and utilities out there.

SPDisposeChecker is such a utility that should be part of every SharePoint developers toolbox.
It helps you analyze your assemblies and points out memory leak patterns before your customer/manager calls you up Friday afternoon.

Read more about the utility and download it here:

Kudos to the SPDisposeChecker team!


And the soundtrack for this post?
L'homme propose, Dieu dispose (Man proposes, God disposes)

Wednesday, March 4, 2009

Enabling detailed errors in Sharepoint

In order to enable detailed error messages on a Sharepoint developer VPC, make following changes in web.config:

1. <SafeMode MaxControls="200" CallStack="true" ... />

2. <customErrors mode="On" />

3. <compilation batch="false" debug="true">

Tuesday, January 6, 2009

The Xcopy /EXCLUDE switch

Have you ever struggled with the /EXCLUDE switch for the good ol´ xcopy DOS command? Well...I have...and the pitfalls described below shows that it can be a bit tricky.


Mission
Copy the content (files and subfolders) from a source directory to a given destination, but exclude some of the files in the source directory. The context in my case was a post-build event in a Visual Studio project that should perform a "developer deploy" to my local Sharepoint site.

Below is the folder structure in Visual Studio that I wanted to copy.

  • All .ascx files under CONTROLTEMPLATES should be copied, but the *.cs files should be excluded.
  • All files under IMAGES should be copied.
  • All files under LAYOUTS should be copied, except from the *.cs files.



Solution
The xcopy /EXCLUDE switch. Should be easy enough...

Pitfalls

  1. The /EXCLUDE:file1[+file2]... switch does not take a set of file-/foldernames that shall be excluded as parameter, but a set of textfiles that contains the file-/foldernames to exclude.
  2. The textfile(s) specifying the files to exclude uses CR+LF as delimitter for each filter string.
  3. The filter string can not include wildcards such as *.cs.
  4. The first line in the textfile(s) shall always be a CR+LF since that line will be skipped.
My post-build script that did the trick
REM === copy .dll to bin folder ===
copy "$(TargetPath)" "C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin\" /y


REM === copy CONTROLTEMPLATES ===
xcopy "$(ProjectDir)CONTROLTEMPLATES\*" "c:\program files\common files\microsoft shared\web server extensions\12\Template\CONTROLTEMPLATES" /E /I /Y /EXCLUDE:$(ProjectDir)XcopyExclude.txt


REM === copy IMAGES===
xcopy "$(ProjectDir)IMAGES\*" "c:\program files\common files\microsoft shared\web server extensions\12\Template\IMAGES" /E /I /Y /EXCLUDE:$(ProjectDir)XcopyExclude.txt


REM === copy LAYOUTS ===
xcopy "$(ProjectDir)LAYOUTS\*" "c:\program files\common files\microsoft shared\web server extensions\12\Template\LAYOUTS" /E /I /Y /EXCLUDE:$(ProjectDir)XcopyExclude.txt


The XcopyExclude.txt content
CR+LF <---- IMPORTANT!
.ascx.cs
.ascx.designer.cs
.aspx.cs
.aspx.designer.cs
.Master.cs
.Master.designer.cs


Note 1): The first line must (for some strange reason) include a CR+LF, since the first line always will be skipped.

Note 2) A single .cs filter would almost have done the trick, but in my specific case such a filter would have excluded the style.css file aswell.


And the soundtrack for this post?
http://www.deezer.com/track/120075