<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>VSX Experience</title>
	<atom:link href="http://vsxexperience.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://vsxexperience.net</link>
	<description>A Developer Experience with Visual Studio Extensibility</description>
	<lastBuildDate>Fri, 30 Sep 2011 09:09:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vsxexperience.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>VSX Experience</title>
		<link>http://vsxexperience.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vsxexperience.net/osd.xml" title="VSX Experience" />
	<atom:link rel='hub' href='http://vsxexperience.net/?pushpress=hub'/>
		<item>
		<title>Extending FxCop Rules with fixing ability</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/</link>
		<comments>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 08:23:39 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[FxCop]]></category>
		<category><![CDATA[CodeAnalysis]]></category>
		<category><![CDATA[Visual Studio 2010 Extensibility]]></category>

		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/</guid>
		<description><![CDATA[Whenever I see a tool telling a developer what to do to fix a problem and that problem is relatively easy to fix, I tend to label the creator of the tool as lazy. If you can find out a problem and know how to fix it, why don’t you offer the solution in place? [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=186&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Whenever I see a tool telling a developer what to do to fix a problem and that problem is relatively easy to fix, I tend to label the creator of the tool as lazy. If you can find out a problem and know how to fix it, why don’t you offer the solution in place?</p>
<p>This is the case with static CodeAnalysis of Visual Studio. It issues FXCop rules to generate warnings/information in the form of &quot;CAXXXX: Micorsoft.xxxx: the message”. </p>
<p>Wouldn’t it be nice to have the ability to right-click on the warning and tell it to fix it?</p>
<p><a href="http://vsxexperience.files.wordpress.com/2011/06/screenshot.png"><img style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="screenshot" border="0" alt="screenshot" src="http://vsxexperience.files.wordpress.com/2011/06/screenshot_thumb.png?w=544&#038;h=249" width="544" height="249" /></a></p>
<p>Well, this is what this blog is about: extending FxCop rules with the ability to fix itself.</p>
<h3>&#160;</h3>
<h3>How it works</h3>
<p>&#160;</p>
<p>It’s actually very simple. We only have an ErrorItem object as input, retrieved from the ErrorList. An ErrorItem does not give you much more than textual information about the origin of the warning/error. No object linked to be used. Only the columns shown in the ErrorList are the properties of the ErrorItem. Luckely it shows the rule identity (CAXXXX). We can use this to look for the fix.</p>
<p>To gather the fixes we make use of an interface, <strong>IFixable</strong>.&#160; The interface looks like this:</p>
<p><a href="http://vsxexperience.files.wordpress.com/2011/06/image.png"><img style="background-image:none;padding-left:0;padding-right:0;display:block;float:none;margin-left:auto;margin-right:auto;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="http://vsxexperience.files.wordpress.com/2011/06/image_thumb.png?w=547&#038;h=176" width="547" height="176" /></a></p>
<p>Members:</p>
<ul>
<li>ErrorMessage: the VS Package will pass the description of the ErrorItem before calling the FixIt </li>
<li>IsBreaking: indicates when the fix is applied it will break the code </li>
<li>RuleIdentifier: here the implementor indicates the RuleId that will be fixed </li>
<li>FixIt(fileName, lineNr, Column): the actual fix. Notice nullable integers are used since the ErrorItem not always gives the needed information. </li>
</ul>
<p>The VS Package has the responsibility of loading the assemblies and showing the command in the context menu. Some notifications (like when it is breaking) to the user are also added. It also provides a FileManager as a tool for loading and saving the file in the VS IDE.</p>
<p>The Package makes use of MEF to load the fixing assemblies. This means you’ll need to apply an export of the interface IFixable. The FileManager, mentioned above, can be imported using the IFileManager interface.</p>
<p>Example of an implementation:</p>
<pre class="code"><span style="color:blue;">using </span>System.ComponentModel.Composition;
<span style="color:blue;">using </span>Elbanique.FxCopRuleFixVSPackageLib;

<span style="color:blue;">namespace </span>RecommendedRulesFixes.Design
{
    <span style="color:gray;">/// &lt;summary&gt;
    /// </span><span style="color:green;">A delegate that handles a public or protected event does not have
    </span><span style="color:gray;">/// </span><span style="color:green;">the correct signature, return type, or parameter names.
    </span><span style="color:gray;">/// </span><span style="color:green;">To fix a violation of this rule, correct the signature,
    </span><span style="color:gray;">/// </span><span style="color:green;">return type, or parameter names of the delegate.
    </span><span style="color:gray;">/// &lt;/summary&gt;
    </span>[<span style="color:#2b91af;">Export</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">IFixable</span>))]
    <span style="color:blue;">public class </span><span style="color:#2b91af;">CA1009 </span>: <span style="color:#2b91af;">IFixable
    </span>{
        <span style="color:blue;">const string </span>id = <span style="color:#a31515;">&quot;CA1009&quot;</span>;

        [<span style="color:#2b91af;">Import</span>(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">IFileManager</span>))]
        <span style="color:blue;">private </span><span style="color:#2b91af;">IFileManager </span>_FileManager { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }

        <span style="color:gray;">/// &lt;summary&gt;
        /// </span><span style="color:green;">Gets the rule identifier.
        </span><span style="color:gray;">/// &lt;/summary&gt;
        </span><span style="color:blue;">public string </span>RuleIdentifier { <span style="color:blue;">get </span>{ <span style="color:blue;">return </span>id; } }

        <span style="color:gray;">/// &lt;summary&gt;
        /// </span><span style="color:green;">Gets a value indicating whether this instance is breaking.
        </span><span style="color:gray;">/// &lt;/summary&gt;
        /// &lt;value&gt;
        /// &lt;c&gt;</span><span style="color:green;">true</span><span style="color:gray;">&lt;/c&gt; </span><span style="color:green;">if this instance is breaking; otherwise, </span><span style="color:gray;">&lt;c&gt;</span><span style="color:green;">false</span><span style="color:gray;">&lt;/c&gt;</span><span style="color:green;">.
        </span><span style="color:gray;">/// &lt;/value&gt;
        </span><span style="color:blue;">public bool </span>IsBreaking { <span style="color:blue;">get </span>{ <span style="color:blue;">return true</span>; } }

        <span style="color:gray;">/// &lt;summary&gt;
        /// </span><span style="color:green;">Gets or sets the error message.
        </span><span style="color:gray;">/// &lt;/summary&gt;
        /// &lt;value&gt;
        /// </span><span style="color:green;">The error message.
        </span><span style="color:gray;">/// &lt;/value&gt;
        </span><span style="color:blue;">public string </span>ErrorMessage { <span style="color:blue;">get</span>; <span style="color:blue;">set</span>; }

        <span style="color:gray;">/// &lt;summary&gt;
        /// </span><span style="color:green;">Fixes the rule.
        </span><span style="color:gray;">/// &lt;/summary&gt;
        /// &lt;param name=&quot;originalFile&quot;&gt;</span><span style="color:green;">The original file.</span><span style="color:gray;">&lt;/param&gt;
        /// &lt;param name=&quot;lineNr&quot;&gt;</span><span style="color:green;">The line nr.</span><span style="color:gray;">&lt;/param&gt;
        /// &lt;param name=&quot;column&quot;&gt;</span><span style="color:green;">The column.</span><span style="color:gray;">&lt;/param&gt;
        /// &lt;returns&gt;
        /// </span><span style="color:green;">True if success, otherwise false.
        </span><span style="color:gray;">/// &lt;/returns&gt;
        </span><span style="color:blue;">public bool </span>FixIt(<span style="color:blue;">string </span>originalFile, <span style="color:blue;">int</span>? lineNr, <span style="color:blue;">int</span>? column)
        {
            <span style="color:blue;">if </span>(_FileManager == <span style="color:blue;">null</span>)
                <span style="color:blue;">return false</span>;

            _FileManager.Open(originalFile);
            <span style="color:blue;">string </span>contextLine = <span style="color:blue;">null</span>;
            <span style="color:blue;">if </span>(lineNr.HasValue)
            {
                contextLine = _FileManager.GetLine(lineNr.Value -1);
                <span style="color:blue;">string </span>fixedLine = FixLine(contextLine);
                _FileManager.ReplaceLine(lineNr.Value - 1, fixedLine);
                _FileManager.Save();
                <span style="color:blue;">return true</span>;
            }

            <span style="color:blue;">return false</span>;
        }

        <span style="color:blue;">private string </span>FixLine(<span style="color:blue;">string </span>contextLine)
        {
            <span style="color:green;">//should be of type:
            //public delegate void AlarmEventHandler(object sender, EventArgs e);
            </span><span style="color:#2b91af;">MethodParser </span>mp = <span style="color:#2b91af;">MethodParser</span>.Create(contextLine);
            <span style="color:blue;">if </span>(mp.Return != <span style="color:#a31515;">&quot;void&quot;</span>)
                mp.Return = <span style="color:#a31515;">&quot;void&quot;</span>;

            <span style="color:blue;">if </span>(mp.Arguments[0].Type != <span style="color:#a31515;">&quot;object&quot;</span>)
                mp.Arguments[0].Type = <span style="color:#a31515;">&quot;object&quot;</span>;

            <span style="color:green;">//should check if the argument is of type EventArgument,
            //no compiled code, thus no can do.

            </span><span style="color:blue;">return </span>mp.ToString();
        }
    }
}</pre>
<p>Before you can use the <strong>FxCopRuleFixVSPackageLib</strong> you have to install the VSPackage. You can find it <a href="http://visualstudiogallery.msdn.microsoft.com/2cd4b189-5579-45d7-b0b3-f9e35fe0df6c"><strong>here</strong></a>. </p>
<p>The location after installation is %USER%\AppData\Local\Microsoft\VisualStudio\10.0\Extensions\Elbanique\FxCopRuleFixVSPackage\1.0\</p>
<p>Now there is still the issue of register the fixing assembly in the MEF container. This can be done by adding a MefComponent to the <em>extension.vsixmanifest</em> file (also located in the installation directory).</p>
<p>For example, presume you created a RecommendedRulesFixes.dll stored on a local drive c:\FxCopExtensions\ this should become:</p>
<pre class="code"><span style="color:blue;">&lt;?</span><span style="color:#a31515;">xml </span><span style="color:red;">version</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">1.0</span>&quot; <span style="color:red;">encoding</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">utf-8</span>&quot;<span style="color:blue;">?&gt;
&lt;</span><span style="color:#a31515;">Vsix </span><span style="color:red;">xmlns:xsi</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">http://www.w3.org/2001/XMLSchema-instance</span>&quot; <span style="color:red;">xmlns:xsd</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">http://www.w3.org/2001/XMLSchema</span>&quot; <span style="color:red;">Version</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">1.0.0</span>&quot; <span style="color:red;">xmlns</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">http://schemas.microsoft.com/developer/vsx-schema/2010</span>&quot;<span style="color:blue;">&gt;
  &lt;</span><span style="color:#a31515;">Identifier </span><span style="color:red;">Id</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">FxCopRuleFixVSPackage.Microsoft.87948990-c755-459d-b04d-4060ea76f5a4</span>&quot;<span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">Name</span><span style="color:blue;">&gt;</span>FxCopRuleFixVSPackage<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Name</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">Author</span><span style="color:blue;">&gt;</span>Elbanique<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Author</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">Version</span><span style="color:blue;">&gt;</span>1.0<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Version</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">Description </span><span style="color:red;">xml:space</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">preserve</span>&quot;<span style="color:blue;">&gt;</span>This package is a tool that allows you to import (MEF) FxCop Rule repair assemblies. In the ErrorList, when selecting an CA-rule and an extension is found to fix it, the 'Fix It' item in the context menu will show up.<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Description</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">Locale</span><span style="color:blue;">&gt;</span>1033<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Locale</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">MoreInfoUrl</span><span style="color:blue;">&gt;</span>http://vsxexperience.net<span style="color:blue;">&lt;/</span><span style="color:#a31515;">MoreInfoUrl</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">Icon</span><span style="color:blue;">&gt;</span>VS2010-FIXIT.png<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Icon</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">PreviewImage</span><span style="color:blue;">&gt;</span>screenshot.png<span style="color:blue;">&lt;/</span><span style="color:#a31515;">PreviewImage</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">SupportedProducts</span><span style="color:blue;">&gt;
      &lt;</span><span style="color:#a31515;">VisualStudio </span><span style="color:red;">Version</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">10.0</span>&quot;<span style="color:blue;">&gt;
        &lt;</span><span style="color:#a31515;">Edition</span><span style="color:blue;">&gt;</span>Pro<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Edition</span><span style="color:blue;">&gt;
      &lt;/</span><span style="color:#a31515;">VisualStudio</span><span style="color:blue;">&gt;
    &lt;/</span><span style="color:#a31515;">SupportedProducts</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">SupportedFrameworkRuntimeEdition </span><span style="color:red;">MinVersion</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">4.0</span>&quot; <span style="color:red;">MaxVersion</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">4.0</span>&quot; <span style="color:blue;">/&gt;
  &lt;/</span><span style="color:#a31515;">Identifier</span><span style="color:blue;">&gt;
  &lt;</span><span style="color:#a31515;">References</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">Reference </span><span style="color:red;">Id</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">Microsoft.VisualStudio.MPF</span>&quot; <span style="color:red;">MinVersion</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">10.0</span>&quot;<span style="color:blue;">&gt;
      &lt;</span><span style="color:#a31515;">Name</span><span style="color:blue;">&gt;</span>Visual Studio MPF<span style="color:blue;">&lt;/</span><span style="color:#a31515;">Name</span><span style="color:blue;">&gt;
    &lt;/</span><span style="color:#a31515;">Reference</span><span style="color:blue;">&gt;
  &lt;/</span><span style="color:#a31515;">References</span><span style="color:blue;">&gt;
  &lt;</span><span style="color:#a31515;">Content</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">VsPackage</span><span style="color:blue;">&gt;</span>FxCopRuleFixVSPackage.pkgdef<span style="color:blue;">&lt;/</span><span style="color:#a31515;">VsPackage</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">MefComponent</span><span style="color:blue;">&gt;</span>FxCopRuleFixVSPackageLib.dll<span style="color:blue;">&lt;/</span><span style="color:#a31515;">MefComponent</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">MefComponent</span><span style="color:blue;">&gt;C</span>:\FxCopExtensions\RecommendedRulesFixes.dll<span style="color:blue;">&lt;/</span><span style="color:#a31515;">MefComponent</span><span style="color:blue;">&gt;
  &lt;/</span><span style="color:#a31515;">Content</span><span style="color:blue;">&gt;
&lt;/</span><span style="color:#a31515;">Vsix</span><span style="color:blue;">&gt;</span></pre>
<p>&#160;</p>
<p align="center">&#8212; Any suggestions on improving the way of registering assemblies are welcome! &#8212;</p>
<p align="left">NOTES:</p>
<ul>
<li>
<div align="left">You can imagine this is not the silver bullet because we have to work with a file as input. No CodeDOM or IL. Therefore, not all rules can be fixable. I’ve deliberately excluded the usage of EnvDTE or MPF when interfacing with fixing assemblies. If the future should prove the nenecessity, a supplementairy interface could be created passing the EnvDTE. </div>
</li>
<li>The package has an assembly (RecommendedRulesFixes.dll) included which &#8211; just for demo reasons – implements some CA rules (CA1009, CA1033, CA1305, CA2112, CA1801, CA2200). If there is enough response on this, I’ll consider to extend this assembly covering all CA rules.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/186/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=186&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2011/06/screenshot_thumb.png" medium="image">
			<media:title type="html">screenshot</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2011/06/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Feature Builder Product Fiche</title>
		<link>http://vsxexperience.net/2011/03/20/feature-builder-product-fiche/</link>
		<comments>http://vsxexperience.net/2011/03/20/feature-builder-product-fiche/#comments</comments>
		<pubDate>Sun, 20 Mar 2011 11:35:14 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[Feature Builder Power Tool]]></category>
		<category><![CDATA[Feature Builder]]></category>

		<guid isPermaLink="false">http://vsxexperience.net/?p=150</guid>
		<description><![CDATA[I added a PDF document to the VSX Reference page. The pdf has 2 pages, one with a view for the user (or developer) and one for the creator (the Author). I use it to give customers a quick view on feature builder to help them make a decission. Free to use, ofcourse.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=150&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I added a <a title="product fiche" href="http://www.elbanique.be/PublicDocuments/Feature_Builder_Product_Fiche.pdf">PDF document</a> to the VSX Reference page. The pdf has 2 pages, one with a view for the user (or developer) and one for the creator (the Author).<br />
I use it to give customers a quick view on feature builder to help them make a decission.<br />
Free to use, ofcourse.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=150&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2011/03/20/feature-builder-product-fiche/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>
	</item>
		<item>
		<title>Feature Builder and Dynamic Visibility</title>
		<link>http://vsxexperience.net/2011/03/10/feature-builder-and-dynamic-visibility/</link>
		<comments>http://vsxexperience.net/2011/03/10/feature-builder-and-dynamic-visibility/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 12:19:00 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[Feature Builder Power Tool]]></category>
		<category><![CDATA[FBPT]]></category>
		<category><![CDATA[MEF]]></category>

		<guid isPermaLink="false">https://vsxexperience.wordpress.com/?p=169</guid>
		<description><![CDATA[Recently I ran into the case where I had to make a context menu item dynamic visible. In this case the menu item must only be visible when the menu is activated on the context of a configuration file, thus when the file has the ‘.config’ extension. With VSX this would be done by handling [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=169&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I ran into the case where I had to make a context menu item dynamic visible. In this case the menu item must only be visible when the menu is activated on the context of a configuration file, thus when the file has the ‘.config’ extension.</p>
<p>With VSX this would be done by handling the <strong>BeforeQueryStatus</strong> event of the <strong>OleMenuCommand</strong>. Within Feature builder the separation between the behavior and execution is applied through the concept of <strong>LaunchPoint</strong> and <strong>Command</strong>. This allows you to write all execution logic within one library, while the Feature specific items are centralized around the package project. In my opinion, this is a very powerful concept making the package clean and specific, and the library reusable for other projects, especially when applying <strong>MEF</strong>.</p>
<p>So now the question: the <strong>LaunchPoint</strong> is located in the package project and holds the trigger for the <strong>BeforeQueryStatus</strong> (<strong>LaunchPoint</strong> inherits from <strong>OleMenuCommand</strong>), but I do not want to write this logic in the package project but in my library project. </p>
<p>If you take a closer look, you can find a <strong>QueryStatusStrategy</strong> property in the <strong>LaunchPoint</strong> class<sup>(*)</sup>. It returns a <strong>IQueryStatusStrategy</strong> interface. This should ring a bell: interface..strategy… DI! Alright, it is setup to make use of <strong>MEF</strong>. So we can place our logic in the library and import it in the <strong>LaunchPoint</strong>. </p>
<p><sup>(*) Also a <strong>OnQueryStatus</strong> method is available and could be used, but this would not follow the separation methodology.</sup></p>
<p>Let’s apply this.</p>
<p><strong>IQueryStatusStrategy</strong> </p>
<p>This interface only has one method to implement:</p>
<blockquote><p><font face="Consolas"><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">interface</span> IQueryStatusStrategy         <br />{         <br />&#160;&#160;&#160; QueryStatus QueryStatus(IFeatureExtension feature);         <br />}</font></p>
</blockquote>
<p>where <strong>QueryStatus</strong> is a propertybag with<strong>&#160;</strong>2 boolean properties, Enabled and Visible, and <strong>IFeatureExtension</strong> a reference to the extension calling this method</p>
<p>To get to the selected item we use the <strong>EnvDTE</strong>. To obtain it, import the <strong>SVsServiceProvider</strong>. Check on the extension and set the <strong>Visible</strong> property of the local created <strong>QueryStatus</strong>.</p>
<p>Wrapping it up results in this:</p>
<blockquote><p><font face="Consolas"><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> OnlyVisibleOnConfigQueryStrategy : IQueryStatusStrategy         <br />{         <br />&#160;&#160;&#160; [Import]         <br /><span style="color:#0000ff;">&#160;&#160;&#160; public</span> SVsServiceProvider ServiceProvider { get; set; }         </p>
<p><span style="color:#0000ff;">&#160;&#160;&#160; public</span> QueryStatus QueryStatus(IFeatureExtension feature)         <br />&#160;&#160;&#160; {         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueryStatus queryStatus = <span style="color:#0000ff;">new</span> QueryStatus();         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; queryStatus.Visible = <span style="color:#0000ff;">false</span>;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; queryStatus.Enabled = <span style="color:#0000ff;">true</span>;         </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#008000;">//</span>         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#008000;">//check to see if item is a config file (check on extension)</span>         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#008000;">//</span>         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; var dte = ServiceProvider.GetService&lt;EnvDTE.DTE&gt;();         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#0000ff;">if</span> (dte != <span style="color:#0000ff;">null</span> &amp;&amp; dte.SelectedItems.Count &gt; 0)         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var firstItem = dte.SelectedItems.Item(1);         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#0000ff;">if</span> (firstItem != <span style="color:#0000ff;">null</span> &amp;&amp;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; firstItem.Name.EndsWith(<span style="color:#006080;">&quot;.config&quot;</span>))         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; queryStatus.Visible = <span style="color:#0000ff;">true</span>;         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }         </p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <span style="color:#0000ff;">return</span> queryStatus;         <br />&#160;&#160;&#160; }         <br />}</font></p>
</blockquote>
<div>&#160;</div>
<p>Now we just have to export it to the <strong>MEF</strong>. The feature package already does the importing for the library project, so no extra effort needed here to make it visible in the container.</p>
<p>To export, place the export attribute on the class. I use a contractname to identify the strategy:</p>
<blockquote><p><font face="Consolas">[Export(<span style="color:#006080;">&quot;OnlyVisibleOnConfigQueryStrategy&quot;</span>, <span style="color:#0000ff;">typeof</span>(IQueryStatusStrategy))]         <br /><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> OnlyVisibleOnConfigQueryStrategy : IQueryStatusStrategy</font></p>
</blockquote>
<p><strong>LaunchPoint</strong> </p>
<p>We cannot apply the import on the generated class, otherwise it would be overridden when regenerated. So create a partial class in the package project and implement the import of the <strong>QueryStatusStrategy </strong>on this partial class.</p>
<p>The full implementation of the <strong>LaunchPoint</strong> looks like this:</p>
<blockquote><p><font face="Consolas"><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">partial</span> <span style="color:#0000ff;">class</span> VsLaunchPointDynamic : VsLaunchPoint         <br />{         <br />&#160;&#160;&#160; [Import(<span style="color:#006080;">&quot;OnlyVisibleOnConfigQueryStrategy&quot;</span>, <span style="color:#0000ff;">typeof</span>(IQueryStatusStrategy))]         <br />&#160;&#160;&#160; <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">override</span> IQueryStatusStrategy QueryStatusStrategy         <br />&#160;&#160;&#160; {         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; get { <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">base</span>.QueryStatusStrategy; }         <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; set { <span style="color:#0000ff;">base</span>.QueryStatusStrategy = <span style="color:#0000ff;">value</span>; }         <br />&#160;&#160;&#160; }         <br />}</font></p>
</blockquote>
<div>&#160;</div>
<div>That’s all to it. </div>
<p>Working this way, you can build a strategy library with common scenario’s.</p>
<p>Maybe this can have a place in the <a href="http://fbcontrib.codeplex.com/">Feature builder contrib</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/169/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/169/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/169/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=169&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2011/03/10/feature-builder-and-dynamic-visibility/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>
	</item>
		<item>
		<title>Feature Builder Power Tool Review &#8211; Introduction</title>
		<link>http://vsxexperience.net/2010/09/01/feature-builder-power-tool-review-introduction/</link>
		<comments>http://vsxexperience.net/2010/09/01/feature-builder-power-tool-review-introduction/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 20:40:18 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[Feature Builder Power Tool]]></category>

		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2010/09/01/feature-builder-power-tool-review-introduction/</guid>
		<description><![CDATA[Recently I installed the Feature Builder Power Tool from here. This VSIX file will install into the Visual Studio Extensions. You should be able to see it appear in your Installed Extensions of the Extension Manager (Tools &#62; Extension Manager). Important: currently it’s only available for the Visual Studio Ultimate edition to author the feature [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=153&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Recently I installed the Feature Builder Power Tool from <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/396c5990-6356-41c0-aa20-af4c3e58c7ae" target="_blank">here</a>. This VSIX file will install into the Visual Studio Extensions. You should be able to see it appear in your <em>Installed Extensions</em> of the <em>Extension Manager </em>(Tools &gt; Extension Manager).</p>
<p><strong>Important</strong>: currently it’s only available for the Visual Studio Ultimate edition to author the feature extension, though it can be deployed and used in the Professional edition.</p>
<p><strong>Prerequisites</strong>: Visual Studio SDK</p>
<p>The Feature Builder Power Tool (FBPT) is intended as the successor of Guidance Automation, thus to make it easier to reuse code-based assets and practices by providing a predictable way of packaging and deploying them in Visual Studio. With the introduction of Visual Studio Visualization and Modeling (successor of DSL) and MEF there was a new set of tools within Visual Studio to achieve this goal. Besides the new tools Workflow is added, more later on this topic. As with the DSL tools, the package itself is build with it’s own package.</p>
<p>FBPT is build upon 3 core concepts: <em>Map</em>, <em>Tools</em> and <em>Code</em>.</p>
<ul>
<li>Map: guidance for the developer and associated documentation </li>
<li>Tools: Visual Studio Automation </li>
<li>Code: artifacts </li>
</ul>
<p>The package comes with a set of pre-configured project templates, which gives you a quick start. You can find them in the <em>New Project</em> dialog under the <em>Extensibility</em> node as shown in figure.</p>
<p><a href="http://vsxexperience.files.wordpress.com/2010/09/image.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="image" border="0" alt="image" src="http://vsxexperience.files.wordpress.com/2010/09/image_thumb.png?w=432&#038;h=279" width="432" height="279" /></a></p>
<p>Let’s look which template contains what and what it is intended for.</p>
<ol>
<li>Info Pack Scenario: Guidance through documentation only; issues only the <em>Map</em> </li>
<li>VSX Pack Scenario: Automation only; issues only the <em>Tool</em> </li>
<li>Starter Pack Scenario: Documents and Source Code; issues the <em>Map</em> and <em>Tools</em> </li>
<li>Starter Pack + Tools Scenario: Automation, Source Code and Documents; issues the <em>Tools</em>, <em>Code</em> and <em>Map</em> </li>
<li>Blueprint Scenario: Automation, Source Code and Documents; issues the <em>Tools</em>, <em>Code</em> and <em>an ”enhanced” Map </em>(additional pre- and post-conditions on the guidance) </li>
<li>Ultimate Blueprint Scenario: above + additional modeling features </li>
<li>Modeling scenario: only the modeling features, issues <em>an ”enhanced” Map </em></li>
</ol>
<p>In my opinion, these project templates have no added value when developing a packages. On the other hand, I find them very useful for didactical usage, to explore the possibilities. </p>
<p>Beside the scenario focused project templates there are 2 “naked” project templates: Feature Extension for Premium And Ultimate and Feature Extension for Pro, Premium and Ultimate. Both have a simple one-step workflow and an empty project template. The later can contain tooling that leverages Architect Explorer and UML modeling.</p>
<p>When starting a new project one of the last 2 are recommended.</p>
<p>In future blogs I will first explain the 3 basic concepts and explain the interaction between them to establish a package. Automatically, we’ll hit one of the above project templates.</p>
<p>I should also mention, since the project templates are build with the FBPT itself, when opening a project from the list, it should already give you a good idea of the capabilities of FBPT.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=153&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2010/09/01/feature-builder-power-tool-review-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/09/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Feature Builder Power Tool &#8211; release 1.0 coming very soon</title>
		<link>http://vsxexperience.net/2010/07/13/feature-builder-power-tool-release-1-0-coming-very-soon/</link>
		<comments>http://vsxexperience.net/2010/07/13/feature-builder-power-tool-release-1-0-coming-very-soon/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 19:26:08 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Feature Builder Power Tool]]></category>
		<category><![CDATA[VSX]]></category>

		<guid isPermaLink="false">http://vsxexperience.net/?p=148</guid>
		<description><![CDATA[Feature Builder is a Power Tool for Visual Studio 2010 promises that it wil help to easily create rich Visual Studio extensions. I should quickly package up sample code with custom menus, or create complete automated guidance experiences targeted toward a specific technology. I&#8217;m very curious and wil shortly dive into it. Keep track of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=148&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Feature Builder is a Power Tool for Visual Studio 2010 promises that it wil help to easily create rich Visual Studio extensions. I should quickly package up sample code with custom menus, or create complete automated guidance experiences targeted toward a specific technology.<br />
I&#8217;m very curious and wil shortly dive into it.</p>
<p>Keep track of http://visualstudiogallery.msdn.microsoft.com/en-us/396c5990-6356-41c0-aa20-af4c3e58c7ae to get the release.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/148/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/148/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/148/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=148&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2010/07/13/feature-builder-power-tool-release-1-0-coming-very-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>
	</item>
		<item>
		<title>The build process of an Integration Package (part I)</title>
		<link>http://vsxexperience.net/2010/03/31/the-build-process-of-an-integration-package-part-i/</link>
		<comments>http://vsxexperience.net/2010/03/31/the-build-process-of-an-integration-package-part-i/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 11:58:28 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[VSX]]></category>
		<category><![CDATA[MSBuild]]></category>

		<guid isPermaLink="false">http://vsxexperience.wordpress.com/2010/03/31/the-build-process-of-an-integration-package-part-i/</guid>
		<description><![CDATA[This series of posts describe the inner workings of how a package is build with focus on the VSCT file. In this part we’ll ravel out the parts of the build process. When building a package in Visual Studio, the project file is used as an input on which items to include in the build. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=147&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This series of posts describe the inner workings of how a package is build with focus on the VSCT file. In this part we’ll ravel out the parts of the build process.</p>
<p>When building a package in Visual Studio, the project file is used as an input on which items to include in the build. When you open up a csproj file of a integration package project (unload the project and open for edit) you can find next items which are related to the package type project:</p>
<ul>
<li>EmbeddedResource Include=”VSPackage.resx” with children MergeWithCTO and ManifestResourceName </li>
<li>None Include=”source.extension.vsixmanifest” with child SubType Designer </li>
<li>VSCTCompile Include”xxx.vsct” with children ResourceName and SubType Designer </li>
<li>A PropertyGroup with children TargetRegistryRoot, RegisterOutputPackage and RegisterWithCodebase </li>
<li>An Import tag with attribute Project=”…Microsoft.VsSDK.Targets” </li>
</ul>
<ul>It is actually very simple to find out which items belong to the VSX since they are not included in the schema (<a title="http://schemas.microsoft.com/developer/msbuild/2003" href="http://schemas.microsoft.com/developer/msbuild/2003">http://schemas.microsoft.com/developer/msbuild/2003</a>) and therefore are indicated as invalid.</ul>
<ul>The VSPackage.resx is a resource for the package <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . You can find references to it in the InstalledProductRegistrationAttribute on the package class.</ul>
<p>The source.extension.vsixmanifest is the designer for the VSIX manifest, it declares what type of extensions are provided by the content in the VSIX. For more info about VSIX files see Quan To’s <a href="http://blogs.msdn.com/quanto/archive/2009/05/26/what-is-a-vsix.aspx">post</a> on VSIX.</p>
<p>The VSCT file is the source for the command table (see further). The <font size="2" face="Courier New">&lt;SubType&gt;Designer&lt;/Subtype&gt;</font> on the vsct file tells VS to show a View Code/View Designer group in the context menu. In both cases it opens up a xml designer.</p>
<p>The PropertyGroup are options of the VSIX build process and can be found in the property page of the project in the VSIX tab.</p>
<p>All the previous items are used during the build process. This process is declared in the import tag pointing to a build targets file : “$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets”. This file can be found typically in the “C:\Program Files\MSBuild\Microsoft\VisualStudio\v10.0\VSSDK” folder. When you open this folder you can find the <font size="2" face="Courier New">Microsoft.VsSDK.targets, <font size="2" face="Courier New">Microsoft.VsSDK.Common.targets</font>&#160;</font>files and an assembly <font size="2" face="Courier New">Microsoft.VsSDK.Build.Tasks</font>. These are the key players of the build process.</p>
<p>If we take a look at the tasks, we could categorize them as in beneath image:</p>
<p><img style="display:inline;border-width:0;" title="VSSDK Build steps" border="0" alt="VSSDK Build steps" src="http://vsxexperience.files.wordpress.com/2010/03/vssdkbuildsteps.png?w=495&#038;h=318" width="495" height="318" /> </p>
<ol>
<li>Check On VsSDK installation: checks if VsSDK is installed </li>
<li>Compile VSCT: compiles the VSCT file into a CTO file (command table) </li>
<li>Deploy VSIX: prepares for the deployment of the package </li>
<li>Merge CTO resource: check on resources (like MenuResource) to merge into the cto file </li>
<li>Generate Code from LEX/YACC files: the language token and lexical classes used to enable syntax coloring (see Babel) </li>
<li>Generate PkgDef file: generates the package definition file which represents registry values that are created when an application is installed on a computer and that are referenced by the Visual Studio Shell when it starts the application. </li>
<li>Generate Zip file: generates the Zip file to be deployed </li>
</ol>
<p>In next post we’ll take a closer look at the tasks related to the VSCT file.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/147/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=147&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2010/03/31/the-build-process-of-an-integration-package-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/03/vssdkbuildsteps.png" medium="image">
			<media:title type="html">VSSDK Build steps</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing to the VS ErrorList</title>
		<link>http://vsxexperience.net/2010/03/23/writing-to-the-vs-errorlist/</link>
		<comments>http://vsxexperience.net/2010/03/23/writing-to-the-vs-errorlist/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 21:00:08 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[VSX]]></category>
		<category><![CDATA[ErrorList]]></category>

		<guid isPermaLink="false">http://vsxexperience.net/?p=127</guid>
		<description><![CDATA[The Shell provides a class to gain access to the ErrorList pane : ErrorListProvider. It implements the Add/Remove of ErrorList items in the ErrorList pane. To gain access to this provider it expects a ServiceProvider in the constructor. This provider can be the GlobalService of the Package class. An ErrorList item is a class (called ErrorTask) where [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=127&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Shell provides a class to gain access to the ErrorList pane : ErrorListProvider. It implements the Add/Remove of ErrorList items in the ErrorList pane. To gain access to this provider it expects a ServiceProvider in the constructor. This provider can be the GlobalService of the Package class.</p>
<p>An ErrorList item is a class (called ErrorTask) where you can set all needed properties to navigate to the location in the document, categorize it and show the message.</p>
<p>So, it&#8217;s a quite simple and natural way of showing items in the ErrorList. I&#8217;ll show you the details now.</p>
<p>The simpliest approach is to create a helper class that implements the IServiceProvider interface; the implementation body of this interface (GetService(Type)) is a call to the Package.GetGlobalService(serviceType). Now we enabled the construction of the ErrorListProvider with this helper class.</p>
<pre>public class ErrorListHelper : IServiceProvider
{
   public object GetService(Type serviceType)
    {
        return Package.GetGlobalService(serviceType);
    }
}</pre>
<p>Now we can instantiate the ErrorListProvider: it is important here to give the provider a name and a new guid. Try to avoid making a new (= new guid and name) ErrorListProvider for each call. Consider making a singleton to access the helper class, if so make it scope the package only (for example by making the class generic).</p>
<pre>public class ErrorListHelper : IServiceProvider
{
    public ErrorListProvider GetErrorListProvider()
    {
        ErrorListProvider provider = new ErrorListProvider(this);//this implementing IServiceProvider
        provider.ProviderName = {name scoping package};
        provider.ProviderGuid = {guid scoping package};
        return provider;
    }
}</pre>
<p>Now that we have the ErrorListProvider in place, we have to make the helper class to add and remove items from the list: this includes, creating a ErrorTask object and handle the event to navigate to the context document&#8217;s position.</p>
<p>Lets start taking a look on how to create a ErrorTask object:</p>
<pre>public void Write(
            TaskCategory category,
            TaskErrorCategory errorCategory,
            string context, //used as an indicator when removing
            string text,
            string document,
            int line,
            int column)
{
    ErrorTask task = new ErrorTask();
    task.Text = text;
    task.ErrorCategory = errorCategory;
    //The task list does +1 before showing this numbers
    task.Line = line - 1;
    task.Column = column - 1;
    task.Document = document;
    task.Category = category;

    if(! string.IsNullOrEmpty(document))
    {
        //attach to the navigate event
        task.Navigate += NavigateDocument;
    }   
    GetErrorListProvider().Tasks.Add(task);//add it to the errorlistprovider</pre>
<p>}</p>
<p>Now that we have the ErrorTask in place, we can take a look at the handling of the Navigate event. This is a bit of code that I have centralized in another helper class to be reusable.</p>
<pre>void NavigateDocument(object sender, EventArgs e)
{
    Task task = sender as Task;
    if (task == null)
    {
        throw new ArgumentException("sender");
    }
    //use the helper class to handle the navigation
    ShellContext.OpenDocumentAndNavigateTo(task.Document, task.Line, task.Column);
}</pre>
<p>What it must cover:</p>
<ul>
<li>get the VS service to open the document (IVsShellOpenDocument)</li>
<li>open the document via the OpenDocumentViaProject; this gives you a pointer to the frame (IVsWindowFrame) hosting the document</li>
<li>use the frame to get the VsTextBuffer</li>
<li>get the VS service that manages the textbuffer (VsTextManager) and use it to navigate to the position in the document</li>
</ul>
<p>Here is the peace of code that does this:</p>
<pre>    public static void OpenDocumentAndNavigateTo(
                                    string path, int line, int column)
    {
        IVsUIShellOpenDocument openDoc =
            Package.GetGlobalService(typeof(IVsUIShellOpenDocument))
                    as IVsUIShellOpenDocument;
        if (openDoc == null)
        {
            return ;
        }
        IVsWindowFrame frame;
        Microsoft.VisualStudio.OLE.Interop.IServiceProvider sp;
        IVsUIHierarchy hier;
        uint itemid;
        Guid logicalView = VSConstants.LOGVIEWID_Code;
        if (ErrorHandler.Failed(
            openDoc.OpenDocumentViaProject(path, ref logicalView, out sp, out hier, out itemid, out frame))
            || frame == null)
        {
            return ;
        }  
        object docData;  
        frame.GetProperty((int)__VSFPROPID.VSFPROPID_DocData, out docData);  

        // Get the VsTextBuffer  
        VsTextBuffer buffer = docData as VsTextBuffer;  
        if (buffer == null )  
        {  
            IVsTextBufferProvider bufferProvider = docData as IVsTextBufferProvider;  
            if (bufferProvider != null )  
            {  
                IVsTextLines lines;  
                ErrorHandler.ThrowOnFailure(bufferProvider.GetTextBuffer(out lines));  
                buffer = lines as VsTextBuffer;  
                Debug.Assert(buffer != null, "IVsTextLines does not implement IVsTextBuffer");  
                if (buffer == null)  
                {  
                   return ;  
                }  
            }  
        } 
        // Finally, perform the navigation.  
        IVsTextManager mgr = Package.GetGlobalService(typeof(VsTextManagerClass))
             as IVsTextManager;  
        if (mgr == null)  
        {  
            return;  
        }  
        mgr.NavigateToLineAndColumn(buffer, ref logicalView, line, column, line, column);  
    }</pre>
<p>To remove the ErrorTask from the list, make use of the same Guid/Name to re-instantiate the ErrorListProvider.  The context argument in the write method can be used to remove all ErrorTasks for this context. The handling with the context is not covered here, because this post is focussed on the element to make this work.</p>
<p>When removing you should use the SuspendRefresh() before removing and ResumeRefresh() after the items are removed to avoid flickering.</p>
<p> With all this parts paste together it should do the job, for me it did <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=127&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2010/03/23/writing-to-the-vs-errorlist/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>
	</item>
		<item>
		<title>VS Menu CommandId&#8217;s listed</title>
		<link>http://vsxexperience.net/2010/02/18/vs-menu-commandids-listed/</link>
		<comments>http://vsxexperience.net/2010/02/18/vs-menu-commandids-listed/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 09:47:57 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[VSX]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>
		<category><![CDATA[Vs MenuId]]></category>
		<category><![CDATA[VSCT]]></category>

		<guid isPermaLink="false">http://vsxexperience.net/?p=77</guid>
		<description><![CDATA[Isn&#8217;t it hard, each time you want to attach your menuitem to a VS menu, to find the correct guid of that menu ? You can search in the vsshlids.h header file or set the EnableVSIPLogging registrykey to debug the VS (see Dr. eX&#8217;s Blog ). Second option is very helpfull but you have to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=77&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Isn&#8217;t it hard, each time you want to attach your menuitem to a VS menu, to find the correct guid of that menu ? You can search in the vsshlids.h header file or set the EnableVSIPLogging registrykey to debug the VS (see <a href="http://blogs.msdn.com/dr._ex/archive/2007/04/17/using-enablevsiplogging-to-identify-menus-and-commands-with-vs-2005-sp1.aspx" target="_blank">Dr. eX&#8217;s Blog</a> ). Second option is very helpfull but you have to write down the Id&#8217;s, no copy/past available here. You can imagine that this is very error proun. To avoid this repetitive handling, I decided to keep track of all the Id&#8217;s I found so far. This means this post will regulary be updated.</p>
<p>Following sections are covered:</p>
<ul>
<li><a title="Team Explorer" href="#teamexplorer">Team Explorer</a></li>
</ul>
<h3>Considerations</h3>
<h4>Attaching your menu to a VS menu</h4>
<p>When you have found out the id of the VS Menu you want to attach to, you have to:</p>
<p>1. Define the id in the Symbols section of the vsct file.</p>
<p>The Guid is the GuidSymbol id, the Id the IDSymbol (listed in this post)</p>
<pre><span style="color:#339966;">&lt;!-- This is the guid used to group the Team Explorer’s My Favorits together --&gt;</span>
<span style="color:#0000ff;">&lt;</span><span style="color:#993300;">GuidSymbol</span> <span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">guidTE_MyFavoritesCmdSet</span>" <span style="color:#ff0000;">value</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">{7DD170F4-0855-4A2D-B3AA-7FB59A79D27D}</span>"<span style="color:#0000ff;">&gt;</span>
      <span style="color:#0000ff;">&lt;</span><span style="color:#993300;">IDSymbol</span> <span style="color:#ff0000;">name</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">MyFavorites</span>" <span style="color:#ff0000;">value</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">256</span>" <span style="color:#0000ff;">/&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#993300;">GuidSymbol</span><span style="color:#0000ff;">&gt;</span></pre>
<p>2. Use it as a parent in your Group</p>
<pre><span style="color:#339966;">&lt;!—Your command group attaching to the context menu of the MyFavorits tag in the Team Explorer window--&gt;</span>
<span style="color:#0000ff;">&lt;</span><span style="color:#993300;">Group</span> <span style="color:#ff0000;">guid</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">guidMyPackageCmdSet</span>" <span style="color:#ff0000;">id</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">MyMenuGroup</span>" <span style="color:#ff0000;">priority</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">0x0600</span>"<span style="color:#0000ff;">&gt;</span>
   <span style="color:#0000ff;">&lt;</span><span style="color:#993300;">Parent</span> <span style="color:#ff0000;">guid</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">guidTE_MyFavoritesCmdSet</span>" <span style="color:#ff0000;">id</span><span style="color:#0000ff;">=</span>"<span style="color:#0000ff;">MyFavorites</span>"<span style="color:#0000ff;">/&gt;</span>
<span style="color:#0000ff;">&lt;/</span><span style="color:#993300;">Group</span><span style="color:#0000ff;">&gt;</span></pre>
<h4>Using dymamic visibility</h4>
<p>When using dymamic visibility (= setting CommandFlag DynamicVisibility on your button in the vsct file and subscribing on the OnBeforeQueryStatus of the OleMenuCommand) you have to set the ProvideAutoLoadAttibute on your Package class to enable the querying.</p>
<pre>[<span style="color:#20b2aa;">ProvideAutoLoad</span>("<span style="color:#993300;">{adfc4e64-0397-11d1-9f4e-00a0c911004f}</span>")] <span style="color:#339966;">//NoSolution</span>
<span style="color:#0000ff;">public sealed class </span><span style="color:#20b2aa;">MyPackage</span>: <span style="color:#20b2aa;">Package</span>
{
}</pre>
<p>You can find the UIContext id&#8217;s in the vsshlid.h header file ({SDK directory} \VisualStudioIntegration\Common\Inc). For completeness I&#8217;ll state them here too.</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="319" valign="top">UIContext</td>
<td width="319" valign="top">Guid</td>
</tr>
<tr>
<td width="319" valign="top">SolutionBuilding</td>
<td width="319" valign="top">{adfc4e60-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">Debugging</td>
<td width="319" valign="top">{adfc4e61-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">FullScreenMode</td>
<td width="319" valign="top">{adfc4e62-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">DesignMode</td>
<td width="319" valign="top">{adfc4e63-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">NoSolution</td>
<td width="319" valign="top">{adfc4e64-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">SolutionExists</td>
<td width="319" valign="top">{f1536ef8-92ec-443c-9ed7-fdadf150da82}</td>
</tr>
<tr>
<td width="319" valign="top">EmptySolution</td>
<td width="319" valign="top">{adfc4e65-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">SolutionHasSingleProject</td>
<td width="319" valign="top">{adfc4e66-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">SolutionHasMultipleProjects</td>
<td width="319" valign="top">{93694fa0-0397-11d1-9f4e-00a0c911004f}</td>
</tr>
<tr>
<td width="319" valign="top">CodeWindow</td>
<td width="319" valign="top">{8fe2df1d-e0da-4ebe-9d5c-415d40e487b5}</td>
</tr>
<tr>
<td width="319" valign="top">NotBuildingAndNotDebugging</td>
<td width="319" valign="top">{48ea4a80-f14e-4107-88fa-8d0016f30b9c}</td>
</tr>
<tr>
<td width="319" valign="top">SolutionExistsAndNotBuildingAndNotDebugging</td>
<td width="319" valign="top">{d0e4deec-1b53-4cda-8559-d454583ad23b}</td>
</tr>
</tbody>
</table>
<p>Tip: you could place them in a separate class and use them as constants.</p>
<h3>Lists</h3>
<table>
<tbody>
<tr>
<td><a name="teamexplorer"></a><strong>Team Explorer</strong></td>
</tr>
<tr>
<td><a href="http://vsxexperience.files.wordpress.com/2010/02/teamfoundationserver.jpg"><img class="alignleft size-thumbnail wp-image-86" title="TeamFoundationServer" src="http://vsxexperience.files.wordpress.com/2010/02/teamfoundationserver.jpg?w=150&#038;h=123" alt="" width="150" height="123" /></a></td>
<td>Group: guidTE_TeamProjectServerCmdSet &#8211; GUIDSymbol: {23D49123-60AC-4D7E-939A-E01A4E176BEE}</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="213" valign="top">Context</td>
<td width="213" valign="top">IDSymbol</td>
</tr>
<tr>
<td width="213" valign="top">Team Foundation Server</td>
<td width="213" valign="top">256</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td><a href="http://vsxexperience.files.wordpress.com/2010/02/myfavorits.jpg"><img class="alignleft size-thumbnail wp-image-87" title="MyFavorits" src="http://vsxexperience.files.wordpress.com/2010/02/myfavorits.jpg?w=146&#038;h=132" alt="" width="146" height="132" /></a></td>
<td>Group: guidTE_MyFavoritesCmdSet &#8211; GUIDSymbol: {7DD170F4-0855-4A2D-B3AA-7FB59A79D27D}</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="213" valign="top">Context</td>
<td width="213" valign="top">IDSymbol</td>
</tr>
<tr>
<td width="213" valign="top">My Favorites</td>
<td width="213" valign="top">256</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td><a href="http://vsxexperience.files.wordpress.com/2010/02/teamproject.jpg"><img class="alignleft size-thumbnail wp-image-88" title="TeamProject" src="http://vsxexperience.files.wordpress.com/2010/02/teamproject.jpg?w=150&#038;h=133" alt="" width="150" height="133" /></a></td>
<td>Group: guidTE_TeamProjectCmdSet - GUIDSymbol: {D309F791-903F-11D0-9EFC-00A0C911004F}</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="213" valign="top">Context</td>
<td width="213" valign="top">IDSymbol</td>
</tr>
<tr>
<td width="213" valign="top">Team Project</td>
<td width="213" valign="top">1799</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td><a href="http://vsxexperience.files.wordpress.com/2010/02/workitems.jpg"><img class="alignleft size-medium wp-image-91" title="WorkItems" src="http://vsxexperience.files.wordpress.com/2010/02/workitems.jpg?w=151&#038;h=300" alt="" width="151" height="300" /></a></td>
<td>Group: guidTE_WorkItemsCmdSet &#8211; GUIDSymbol: {2DC8D6BB-916C-4B80-9C52-FD8FC371ACC2}</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="213" valign="top">Context</td>
<td width="213" valign="top">IDSymbol</td>
</tr>
<tr>
<td width="213" valign="top">Work Items</td>
<td width="213" valign="top">513</td>
</tr>
<tr>
<td width="213" valign="top">Query Folder (*1)</td>
<td width="213" valign="top">514</td>
</tr>
<tr>
<td width="213" valign="top">Query (*2)</td>
<td width="213" valign="top">515</td>
</tr>
</tbody>
</table>
<p>(*1): My Queries, Team Queries, Workbook Queries<br />
(*2): MyBugs, MyTasks, OpenIssues, Product Backlog (Workbook Queries)&#8230;</td>
</tr>
<tr>
<td><a href="http://vsxexperience.files.wordpress.com/2010/02/builds.jpg"><img class="alignleft size-thumbnail wp-image-93" title="Builds" src="http://vsxexperience.files.wordpress.com/2010/02/builds.jpg?w=150&#038;h=142" alt="" width="150" height="142" /></a></td>
<td>Group: guidTE_BuildsCmdSet &#8211; GUIDSymbol: {34586048-8400-472E-BBBF-3AE30AF8046E}</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="213" valign="top">Context</td>
<td width="213" valign="top">IDSymbol</td>
</tr>
<tr>
<td width="213" valign="top">Builds</td>
<td width="213" valign="top">256</td>
</tr>
<tr>
<td width="213" valign="top">Build Definition</td>
<td width="213" valign="top">258</td>
</tr>
<tr>
<td width="213" valign="top">All Build Definitions</td>
<td width="213" valign="top">259</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=77&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2010/02/18/vs-menu-commandids-listed/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/02/teamfoundationserver.jpg?w=150" medium="image">
			<media:title type="html">TeamFoundationServer</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/02/myfavorits.jpg?w=146" medium="image">
			<media:title type="html">MyFavorits</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/02/teamproject.jpg?w=150" medium="image">
			<media:title type="html">TeamProject</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/02/workitems.jpg?w=151" medium="image">
			<media:title type="html">WorkItems</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/02/builds.jpg?w=150" medium="image">
			<media:title type="html">Builds</media:title>
		</media:content>
	</item>
		<item>
		<title>VSXL 1 &#8211; Tackling commands and menus.</title>
		<link>http://vsxexperience.net/2010/01/12/vsxl-1-tackling-commands-and-menus/</link>
		<comments>http://vsxexperience.net/2010/01/12/vsxl-1-tackling-commands-and-menus/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 16:37:46 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[VSX]]></category>
		<category><![CDATA[VSXL]]></category>
		<category><![CDATA[VSCT]]></category>

		<guid isPermaLink="false">http://vsxexperience.net/?p=54</guid>
		<description><![CDATA[This part will explain how we can reorganize the menus and commands to enable usage of an extension package. To get around the workings of menus and commands I can recommend this blog by Inovak. Though it is written to build his VSXtra tool, it explains the inner workings of VS in context of menus [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=54&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This part will explain how we can reorganize the menus and commands to enable usage of an extension package.</p>
<p>To get around the workings of menus and commands I can recommend <a title="this blog" href="http://dotneteers.net/blogs/divedeeper/archive/2008/02/22/LearnVSXNowPart13.aspx" target="_blank">this blog </a>by Inovak. Though it is written to build his VSXtra tool, it explains the inner workings of VS in context of menus and commands.</p>
<p>There is another <a title="blog" href="http://dotneteers.net/blogs/divedeeper/archive/2008/03/02/LearnVSXNowPart14.aspx" target="_blank">blog</a> by Inovak that explains the vsct file, which is a key part in the menus and commands workings (see below).</p>
<p>Next picture gives an overview of the parts that contribute in the menus and commands, based upon Inovak’s blog items.</p>
<p><a href="http://vsxexperience.files.wordpress.com/2010/01/menus-and-toolbars-overview.jpg"><img class="alignnone size-full wp-image-55" title="menus and toolbars overview" src="http://vsxexperience.files.wordpress.com/2010/01/menus-and-toolbars-overview.jpg?w=430&#038;h=302" alt="" width="430" height="302" /></a></p>
<p><strong>Goal</strong></p>
<p>We want the ability to add a (menu) command from a context menu when project is selected.</p>
<p>Let us take a look on what tasks should be automated when we use the current VSX approach:</p>
<ol>
<li>Update the vsct file and let the user give input on how and where the menu is displayed</li>
<li>When dynamic menu, a BeforeQueryStatus eventhandler is needed</li>
<li>Update the initialize method of the custom ‘Package.cs’ file to add the menucommand to the menucommand service</li>
</ol>
<p>The first problem here is, there is no physical file for the command. All coding is done in the ‘package.cs’ file. So, let’s try to migrate the code from the package file to a separate command file.</p>
<p><strong>The Command file.</strong></p>
<p>These are the things that are directly related to the command and can be put in a separate class:</p>
<p>-          The Id of the command: a uint</p>
<p>-          The id of the commandset the command is belonging to : a guid</p>
<p>-          The implementation of execution of the command</p>
<p>-          [Optional] Visibility handling: via BeforeQueryStatus</p>
<p>Regarding the command id; in the MS solution they are gathered in the ‘PkgCmdId.cs’ file. This is not a bad idea since they are a range of id’s and no guids. For example, 0&#215;100 is the first, 0&#215;101 is the second, and so on. Otherwise, it would be nice to have them tightly coupled to the command file itself. So a reference to the id is the preferable solution.</p>
<p>Regarding the commandset id; in the MS solution they are gathered in the ‘GuidList.cs’ file. Since this is a guid and if we make use of a CommandGroup class as a holder of the id, I don’t see the benefit of using this.</p>
<p>Since a command is bound to its package, a reference to this package is also needed.</p>
<p><a href="http://vsxexperience.files.wordpress.com/2010/01/design-command.jpg"><img class="alignnone size-full wp-image-56" title="class diagram command" src="http://vsxexperience.files.wordpress.com/2010/01/design-command.jpg?w=600&#038;h=346" alt="" width="600" height="346" /></a></p>
<p>The CommandGroup itself is merely a representation of the Id. If we want to query which commands are attached, we can either use the VSCT file or query the Commands in the package that point to a specific CommandGroupClass.</p>
<p>The ‘CustomCommand’ is a set of 2 partial classes. One is generated by our integration package (storing the id’s and reference to the type of CommandGroup), another is presented to the developer to implement the base methods. This is called the double-derived pattern. In that way we can regenerate the custom command without removing the implementation.</p>
<p>A second task is to be done when generating a command class: managing the ‘PkgCmdId.cs’ file. Before loading our integration package command, we could load this class into memory and keep it there for the lifetime of the command execution. It should be presented as a package service so we could call something like ‘CreateNewCmdId(string commandName)’. The management and synchronization should be handled by this service. We’ll tackle this issue in a future blog, which will probably be: tackling the services.  </p>
<p>Notice, that to be able to register the command we need to call the IMenuCommandService.  Since the called method ‘GetService’ is declared on the Package class, we can only access it from there. For now, we’ll use a utility to retrieve all the Command classes that need to be registered. Likewise, it will be refactored when tackling the services.</p>
<p>A last task is to keep in sync with the VSCT file. We can make use of XDocument to readout and write to. It should not allow making any changes to the command ids. To make things a little bit easier we can make use of the VS internal RDT (running document table).  To keep in scope, we’ll dedicate this in a separate blog.</p>
<p><strong>VSCT revised</strong></p>
<p>There are a few things that one could change about the way the VSCT file is used. Since it is only a declarative way of showing the command table definitions, it is possible to handle the building of the resources ourselves and create a resource per command. But this would mean that a custom postbuild tool should be made to create this resource. Since the added value of this is minor, I don’t think it’s a good idea.</p>
<p>On the other hand, creating a custom editor for managing the VSCT file looks like a better idea. Of course, I’m not the only one who thought of that: VSCT PowerToy, available at the MSDN code gallery [http://code.msdn.microsoft.com/VSCTPowerToy]. With this tool you cannot only manage your own command table but also look at other packages’ command tables!  It’s a nice way to learn on how to build your own ones.</p>
<p>In the next blog we will show you the coding of this all.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=54&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2010/01/12/vsxl-1-tackling-commands-and-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/01/menus-and-toolbars-overview.jpg" medium="image">
			<media:title type="html">menus and toolbars overview</media:title>
		</media:content>

		<media:content url="http://vsxexperience.files.wordpress.com/2010/01/design-command.jpg" medium="image">
			<media:title type="html">class diagram command</media:title>
		</media:content>
	</item>
		<item>
		<title>Part 2 : Decide Approach</title>
		<link>http://vsxexperience.net/2010/01/02/part-2-decide-approach/</link>
		<comments>http://vsxexperience.net/2010/01/02/part-2-decide-approach/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 10:33:47 +0000</pubDate>
		<dc:creator>Jan Kinable</dc:creator>
				<category><![CDATA[VSX]]></category>
		<category><![CDATA[Visual Studio 2010 Extensibility]]></category>
		<category><![CDATA[VSXL]]></category>

		<guid isPermaLink="false">http://vsxexperience.net/?p=47</guid>
		<description><![CDATA[In previous post I pointed out where I would be focussing on to achieve a better DX with VSX integration package: Refactoring MPF in context of usability Writing a new integration package project Now, after some considerations made, I&#8217;ve decided to change my approach. What I realy want to achieve is to be able to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=47&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In previous post I pointed out where I would be focussing on to achieve a better DX with VSX integration package:</p>
<ul>
<li>Refactoring MPF in context of usability</li>
<li>Writing a new integration package project</li>
</ul>
<p>Now, after some considerations made, I&#8217;ve decided to change my approach. What I realy want to achieve is to be able to present tools to fasten up the development and lower the threshold. Herefore I only need a integration package for the VSX integration package to automate common tasks.</p>
<p>Refactoring the MPF is a good plan, but actually, the only thing that should be refactored is the top-layer, the way MPF organizes itself. I&#8217;ve looked into refactoring it and notice that it tantamounts to change the way it registers components (commands, toolwindows, services). Also, the core of all is enclosed in one file, namely the Package class.</p>
<p>Refactoring would take a massive part of my time, so I looked around to see if someone else would have made the effort. I found a need project, <a title="VSXtra" href="http://vsxtra.codeplex.com/" target="_blank">http://vsxtra.codeplex.com/</a>. This project does all the refactoring. I considered to use it as a base to create my own integration package. I will not use it because of an extra dependency into my package.</p>
<p>It is still my intention to write a new integration package project. I can start with an Integration package to later migrate to a seperate project template.</p>
<p>So to conclude: I will focus on wrap the most of the MPF with a thin layer to automate small pieces of functionality. This way of working allows me to gradually increase the scope and leverage very fast small pieces of automated task without impacting existing VSX packages.</p>
<p>I also named the project VSXL. So from now on I&#8217;ll will use this to address the Visual Studio Integration Package Integration Package.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vsxexperience.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vsxexperience.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vsxexperience.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vsxexperience.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vsxexperience.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vsxexperience.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vsxexperience.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vsxexperience.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vsxexperience.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vsxexperience.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vsxexperience.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vsxexperience.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vsxexperience.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vsxexperience.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vsxexperience.net&amp;blog=11168013&amp;post=47&amp;subd=vsxexperience&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vsxexperience.net/2010/01/02/part-2-decide-approach/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/c9905cad25540ce89f3c02c12c78e4b5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kinablejan</media:title>
		</media:content>
	</item>
	</channel>
</rss>
