Blog Home  Home Feed your aggregator (RSS 2.0)  
.Net Jonesie - SharePoint 2010 Replaceable Parameters
A simple programmers blog
 
# Thursday, April 08, 2010

Loving SharePoint 2010 :) We are doing a LOT of work with this baby and so far it’s been a fairly painless experience.  I’m currently diving deep into creating a custom Service Application… more on these later.

It’s the little things that make the difference for day to day SharePoint dev.  Replaceable parameters are a fantastic worry-removing new features.  In the past (SP 07) you had to include full assembly reference in .ASPX and similar files thus:

SomeNamespace.SomeClass, SomeAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6017a297d36052bf

The problems occur when you update the version of change an assembly name etc – things that can happen quite often during the early stages of a product life cycle.  Getting the key is also a complete PITA.

With replaceable parameters you can let Visual Studio worry about these.

SomeNamespace.SomeClass, $SharePoint.Project.AssemblyFullName$

The parameter will be replace during packaging.  There is a bunch of different parameters you can use in various types of files like XML and ASPX.

HOWEVER, not all files are processed.  In my case I have a .SVC file (for WCF).  Luckily, it’s very easy to add processing for this. 

  1. In Visual Studio, right click the SharePoint project and select Unload.
    image
  2. Right click the project again and select Edit
  3. At the end of the first property group in the proj file, add this: 
    image

You can list as many extensions as you want, seperated by ;.

Full documentation is on MSDN.

 

Enjoy

Thursday, April 08, 2010 10:05:37 AM (New Zealand Standard Time, UTC+12:00)  #    Comments [0]   Sharepoint  | 
Comments are closed.
Copyright © 2012 Peter G Jones. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: