Visual Studio Token Replacement Tip – WCF

 

In earlier post I provided one way to enable automatic token replace when building a WCF service for SharePoint 2010 (but this tip applies for any project really), here is what I said

=============

Setup token replacement, see http://msdn.microsoft.com/en-us/library/ee231545.aspx

Essentially, this minimizes the need to manually add things like a 4-part assembly name. After all, the solution already has that information so why not have VS2010 do the work for you.

Navigate to Program files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\SharePointTools

image

Open up the Microsoft.VisualStudio.SharePoint.targets file and locate the TokenReplacementFileExtensions node.

image

Add svc to the list of replacement extensions

<TokenReplacementFileExtensions>$(TokenReplacementFileExtensions);xml;aspx;ascx;webpart;dwp;svc</TokenReplacementFileExtensions>

=========

The above is ok and works for all your projects except that the file will/could be overwritten by service pack updates. Another way to handle this is to open your *.csproj file and locate the <TokenReplacementFileExtensions> element and add the svc extension directly into the project. Again, see the specifics in http://msdn.microsoft.com/en-us/library/ee231545.aspx

 

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s