[Outercurve Project Leaders] Visual Studio extension for Open RIA Services

Colin Blair mail at colinblair.com
Wed Jan 8 19:45:33 UTC 2014

Any help you can give me would be greatly appreciated. I have been hitting a lot of dead ends because the documentation is spotty and inconsistent and many examples turn out to be wildly out of date. For example, I tried using the AutoExtender example from the VS2005 SDK but I get an invalid cast error occurring inside ENVDTE and I have no way of knowing why. Apparently there was some kind of tool in VS2010 which could give you information about extensions but it doesn't seem to have been maintained.

I will include the code I currently have to set the project property below, but first I will explain what I am doing and why in case anybody has any better ideas. Open RIA Services regenerates the client side proxy every time the client project is built, unlike a regular service reference which gets regenerated only on request. It does this by adding an MSBuild targets file to the project. In Microsoft's original code, the proxy generator was controlled by an MSBuild variable in the project file named LinkedServerProject which was part of the Silverlight project type and edited on the Silverlight tab of project properties. I can't use LinkedServerProject since it still triggers Microsoft original target file, and I want to support more than just Silverlight clients, so I am using my own variable named LinkedOpenRiaServerProject. The Open RIA Services version of the Wizards and templates use the below code to modify the LinkedOpenRiaServerProject value but I need to create a new tool so that my users don't have to manually edit their project file to set the RIA Linked server project.

Long term, my plan is to eliminate the RIA Link completely when I switch over to using Roslyn to generate the client but I am a few years away from doing that.

This is the code that is in one of my template wizards that sets the value in the project file:

string projectReference = webProject.FullName;
if ((webProject.FullName.Length > 0) && Path.IsPathRooted(webProject.FullName))
  projectReference = MakeProjectPathRelative(projectReference, silverlightProject.FullName);
IVsSolution ivsSolution = (IVsSolution)Package.GetGlobalService(typeof(SVsSolution));
IVsHierarchy hierarchy;
ivsSolution.GetProjectOfUniqueName(silverlightProject.UniqueName, out hierarchy);
IVsBuildPropertyStorage buildPropertyStorage = (IVsBuildPropertyStorage)hierarchy;
buildPropertyStorage.SetPropertyValue("LinkedOpenRiaServerProject", null, (uint)_PersistStorageType.PST_PROJECT_FILE, projectReference);

public static string MakeProjectPathRelative(string fullPath, string basePath)
    string localBasePath = basePath;
    string localFullPath = fullPath;
    string relativePath = null;
    if (!localBasePath.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
        localBasePath = localBasePath + Path.DirectorySeparatorChar.ToString();
    localFullPath = localFullPath.ToLowerInvariant();
    localBasePath = localBasePath.ToLowerInvariant();
    while (!string.IsNullOrEmpty(localBasePath))
        if (localFullPath.StartsWith(localBasePath, StringComparison.Ordinal))
            relativePath = relativePath + fullPath.Remove(0, localBasePath.Length);
            if (relativePath == Path.DirectorySeparatorChar.ToString())
                relativePath = "";
            return relativePath;
        localBasePath = localBasePath.Remove(localBasePath.Length - 1);
        int lastIndex = localBasePath.LastIndexOf(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal);
        if (-1 != lastIndex)
            localBasePath = localBasePath.Remove(lastIndex + 1);
            relativePath = relativePath + ".." + Path.DirectorySeparatorChar.ToString();
            return fullPath;
    return fullPath;

From: Jezz Santos [mailto:jezz.santos at hotmail.com]
Sent: Wednesday, January 8, 2014 1:04 PM
To: Colin Blair
Cc: ProjectLeaders at mailinglists.outercurve.org
Subject: Re: [Outercurve Project Leaders] Visual Studio extension for Open RIA Services

Absolutely do.
In fact you can build it yourself in a couple hours.

Colin Blair <mail at colinblair.com<mailto:mail at colinblair.com>> wrote:
Open RIA Services needs a small tool written for Visual Studio 2013 to change a value stored in a project file. The user needs to be able to select a project , get a drop down listing all projects in the solution, select a project, and have the relative path to that project stored as a variable in the project file.

Does anyone have experience extending Visual Studio that could help get this tool written?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailinglists.outercurve.org/pipermail/outercurve-projectleaders/attachments/20140108/a2043c07/attachment.html>

More information about the ProjectLeaders mailing list