<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Incremental Thoughts</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/chuckeng/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/chuckeng/feed.xml</link>
    <description>A set of facts, stories, events, people, and places that I found interesting at some point in time.</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:20:30 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Effective Techniques and Tools for Reducing Leaks in .NET (C#)</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/effective-techniques-and-tools-for-reducing-leaks-in-net-c</link>
      <pubDate>Wed, 26 Oct 2011 13:08:00 GMT</pubDate>
      <dc:creator><![CDATA[Chuck England - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2011/10/26/effective-techniques-and-tools-for-reducing-leaks-in-net-c/</guid>
      <description><![CDATA[But .NET does not allow you to leak??? It's got garbage collection and what not. L 
Sadly, there...]]></description>
      <content:encoded><![CDATA[<p><span style="color: #1f497d;">But .NET does not allow you to leak??? It's got garbage collection and what not. <span style="font-family: Wingdings;">L</span> </span></p>
<p><span style="color: #1f497d;">Sadly, there simply is no mechanism that will give you the flexibility you need, allow you to interoperate with existing legacy code, and allocate and de-allocate handles, memory, and other resources at will without paying a tax. </span></p>
<p><span style="color: #1f497d;">Since I get this question a lot, I thought I would list here are a number of tools and techniques that you can use in your quest to rid your software of leaks. </span></p>
<h1>Use Coding Standard and Best Practices</h1>
<p><span style="color: #1f497d;">Create coding standards and a set of practices for your team that help build clean code to start with. It is much easier to design problems out of the system than it is to find the bug, fix it (without breaking something else), and ship this to your customer. Some of the things you can do are: </span></p>
<p><span style="color: #1f497d;">Require the use of <a href="https://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</a> pattern for any objects that themselves hold references to <a href="https://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</a> objects. Require that the creation of objects that implement <a href="https://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</a> use the "<a href="https://msdn.microsoft.com/en-us/library/yh598w02.aspx">using</a>" clause around all such instances. </span></p>
<p><span style="color: #1f497d;">There are a few instances where doing this will bite you. But, if you use delegation, you can usually wrap these calls in a way that allows you to use the "using". Or, you can simply make sure that when it's not used, that it is clearly documented in the code and there is a clear plan for disposal of the object. For example, in the first case I listed above, an object holds a reference to an <a href="https://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</a> object. In this case, the clear plan it to have the owning object cleanup (dispose) of the owned object(s) during its <a href="https://msdn.microsoft.com/en-us/library/system.idisposable.aspx">IDisposable</a> call. </span></p>
<p><span style="color: #1f497d;">Use the language features (like the new "<a href="https://msdn.microsoft.com/en-us/library/hh156513(v=vs.110).aspx">async</a>" and "<a href="https://msdn.microsoft.com/en-us/library/hh156528(v=VS.110).aspx">await</a>" features in C#, and the new threading items like <a href="https://msdn.microsoft.com/en-us/library/system.threading.tasks.task.aspx">Task</a>) to help simplify multi-threaded code. </span></p>
<p><span style="color: #1f497d;">Require everyone who touches, thinks about touching, has and opinion about or otherwise interacts with the code in any way read these items: </span></p>
<ol>
<li><a href="https://www.albahari.com/threading/">Threading in C#</a><span style="color: #1f497d;"> (free) </span></li>
<li><a href="https://www.amazon.com/Effective-Specific-Ways-Improve-Your/dp/0321245660">Effective C#: 50 Specific Ways to Improve Your C#</a><span style="color: #1f497d;"> </span></li>
<li><a href="https://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=sr_1_1?s=books&amp;ie=UTF8&amp;qid=1319658546&amp;sr=1-1">Code Complete</a><span style="color: #1f497d;"> </span></li>
</ol>
<p>&nbsp;</p>
<p><span style="color: #1f497d;">I also recommend <a href="https://www.amazon.com/Advanced-NET-Debugging-Mario-Hewardt/dp/0321578899/ref=sr_1_1?ie=UTF8&amp;qid=1319657293&amp;sr=8-1">Advanced .NET Debugging</a> and <a href="https://www.amazon.com/Advanced-Windows-Debugging-Mario-Hewardt/dp/0321374460/ref=sr_1_2?ie=UTF8&amp;qid=1319657293&amp;sr=8-2">Advanced Windows Debugging</a>. However, getting folks to read these books might be hard, as </span></p>
<p>&nbsp;</p>
<h1>Test Driven Development</h1>
<p><span style="color: #1f497d;">Debug every line of code you write as you write it. I use unit tests, which I write prior to the code to help me step through the various scenarios for each method. I do not trust myself to get Boolean expressions correct. Instead, I step through the code and make sure my assumptions were correct. </span></p>
<p><span style="color: #1f497d;">If I make assumptions in the code, I write defensive code. I only throw when something goes wrong. I only catch if I know what I am catching, and know what to do with what I caught. Of course, I bend this to perform logging, but then immediately re-throw. </span></p>
<p><span style="color: #1f497d;">I use asserts for when I am debugging code, and I cannot write defensive code (usually due to time constraints) to protect the function. Ideally, these asserts are "to do's" to go back and add defensive code later when I start getting bug reports in the area. </span></p>
<h1>"Break hard fast"</h1>
<p><span style="color: #1f497d;">This is my slogan for development. I learned this through the school of hard knocks. This may not be intuitive to most, but this basically means that when writing compiled code like C#, you want to leverage the compiler type checking and static analysis to get rid of the bulk of you bugs. When that fails, and you make it to runtime, you want your code to fail as close to the time you write the code as you can. And, you want it to be something that blocks you until you fix it. Fixing a bug as you are writing the code allows you to alter the design before the code is in-place, lets you solve the problem while the problem is still in your head, and allows you to quickly give up on poor designs before others become dependent on them. </span></p>
<h1>Detecting Leaks</h1>
<p><span style="color: #1f497d;">Basic resource leak detection can many times be done by using Windows Task Manager. Just add the appropriate fields to the Process view. Then perform the scenarios you are concerned about over and over. </span></p>
<p style="text-align: center;"><img alt="" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/07/83/metablogapi/6204.102611_2008_EffectiveTe1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-07-83-metablogapi/6204.102611_5F00_2008_5F00_EffectiveTe1.png" /><span style="color: #1f497d;"> </span></p>
<p><span style="color: #1f497d;">You can also use Performance Monitor. Visual Studio provides access to the Performance Monitor data inside Visual Studio to observe process memory, timing, etc. (Access it from the menu View -&gt; Other Windows -&gt; Performance Explorer.) </span></p>
<p><span style="color: #1f497d;">Additionally, <a href="https://en.wikipedia.org/wiki/Mark_Russinovich">Mark Russinovich's</a> <a href="https://technet.microsoft.com/en-us/sysinternals/default.aspx">SysInternals</a> tools (now owned by Microsoft), are great for detecting, and sometimes drilling into issues. For example, <a href="https://technet.microsoft.com/en-us/sysinternals/bb896653">Process Explorer</a> is an even better version of Task Manager. It allows you to get callstacks (if <a href="https://support.microsoft.com/kb/823242">symbols</a> are <a href="https://msdn.microsoft.com/en-us/windows/hardware/gg462988">setup correctly</a>), create dumps (well, ok, Task Manager does this too), search for paths to find handles to files, look at the guts of a process, etc. There are many tools in the <a href="https://technet.microsoft.com/en-us/sysinternals/bb842062">Suite</a>, so you should check them out. </span></p>
<p><span style="color: #1f497d;">These tools help you to detect the problem. But you will need to go deeper to find the offending code and fix the issue. </span></p>
<h1>Writing Profiling Code</h1>
<p><span style="color: #1f497d;">You can write profiling code in your application to take snapshots. You can use tracing, performance monitor APIs, other Windows eventing APIs to track resource usage, or use some combination of the above to monitor your app as it runs. This is of course harder. And, it is much easier to design this into the software when you are first building it, than to add it later. </span></p>
<p><span style="color: #1f497d;">I recommend designing performance requirements into every API. This does not mean that the developer has to write any code for performance. Many times, the code they write just works and it is fast enough. But, how do you know if it is fast enough? This is where the requirements will help. </span></p>
<p><span style="color: #1f497d;">The same thing applies to the use of resources. When you create a design, determine what is acceptable or allowed for the process/thread/or object to consume. This works better when you use a holistic view for an entire application than when you are in the details of an API. But, you apply the limits when you are testing the APIs to make sure they comply with the requirements. Note that you may need to specify what can be used for short durations versus long durations. And you will likely need to determine what the right set of durations are. </span></p>
<h1>The Debugger</h1>
<p><span style="color: #1f497d;">The debugger is your friend. Whether you prefer the Visual Studio debugger or WndDbg, you can successfully find leaks and get straight to the problem at hand using a debugger. For .NET code, you will need to load and use <a href="https://msdn.microsoft.com/en-us/library/bb190764.aspx">SOS</a>. (<a href="https://madgeek.com/Articles/Leaks/Leaks.en.html">https://madgeek.com/Articles/Leaks/Leaks.en.html#SOSAndWinDbg</a>). This allows you to look at the managed memory, etc. It is something of a "ninja" approach to leaks, but once you learn the skills you need, you will be an ace wherever you work. <span style="font-family: Wingdings;">J</span> </span></p>
<p><span style="color: #1f497d;">And hey, you are already stepping through every line of code in the debugger as you write it, right? So, while you are there, you can check for leaks and other issues. </span></p>
<h1>Using a Profiler</h1>
<p><span style="color: #1f497d;">In Visual Studio Ultimate and above, you can also is the <a href="https://msdn.microsoft.com/en-us/library/bb385755.aspx">.NET Memory Profiler</a>. I want go into a lot of details here, as there are already a lot of articles on the subject. (See the bottom of this post if you need more to read.) </span></p>
<p><span style="color: #1f497d;">Of course, there are many partners that provide paid tools (which are many times better than the ones we provide). To name only a few: <a href="https://www.jetbrains.com/profiler/features/index.html">JetBrains</a>, <a href="https://www.microfocus.com/products/micro-focus-developer/devpartner/index.aspx">MicroFocus DevPartner</a>, and <a href="https://www.red-gate.com/products/dotnet-development/">RedGate Software</a>. </span></p>
<h1>More Articles on Leaks, Performance, Multi-Threading, etc.</h1>
<p>There are lots of articles on performing leak analysis. Many are geared towards specific things. Not all techniques work for all types of problems. So, determining while you are not releasing a handle can be way different than why your memory keeps climbing.</p>
<p><span style="color: #1f497d;">Here are general articles that I found useful: </span></p>
<p><span style="color: #1f497d;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://msdn.microsoft.com/en-us/magazine/cc188781.aspx">https://msdn.microsoft.com/en-us/magazine/cc188781.aspx</a> </span></p>
<p><span style="color: #1f497d;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://msdn.microsoft.com/msdnmag/issues/1100/GCI/default.aspx">https://msdn.microsoft.com/msdnmag/issues/1100/GCI/default.aspx</a> </span></p>
<p><span style="color: #1f497d;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx">https://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx</a> </span></p>
<p><span style="color: #1f497d;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://msdn.microsoft.com/msdnmag/issues/01/12/hood">https://msdn.microsoft.com/msdnmag/issues/01/12/hood</a> </span></p>
<p><span style="color: #1f497d;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://www.codeproject.com/KB/dotnet/Memory_Leak_Detection.aspx">https://www.codeproject.com/KB/dotnet/Memory_Leak_Detection.aspx</a> </span></p>
<p><span style="color: #1f497d;">&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://channel9.msdn.com/Shows/Going+Deep/Mads-Torgersen-Inside-C-Async">https://channel9.msdn.com/Shows/Going+Deep/Mads-Torgersen-Inside-C-Async</a> </span></p>
<p><a href="https://msdn.microsoft.com/en-us/magazine/cc337887.aspx">https://msdn.microsoft.com/en-us/magazine/cc337887.aspx</a><span style="color: #1f497d;"> </span></p>
<p>&nbsp;</p>
<p><span style="color: #1f497d;">Hope this helps&hellip; </span></p>]]></content:encoded>
    </item>
    <item>
      <title>Splitting Large Solutions</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/splitting-large-solutions</link>
      <pubDate>Tue, 25 Oct 2011 13:39:00 GMT</pubDate>
      <dc:creator><![CDATA[Chuck England - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2011/10/25/splitting-large-solutions/</guid>
      <description><![CDATA[Note: I am a Microsoft Employee, but my views are my own. (*whew* got that off my chest, and...]]></description>
      <content:encoded><![CDATA[<p>Note: I am a Microsoft Employee, but my views are my own. (*whew* got that off my chest, and satisfied internal requirements)</p>
<p>If you have a large solution, you may find that yourself wanting to split your solution into several parts. If your projects are not inter-connected, this works fine. Basically, you just move the various apps into their own solutions. This allows you to load them faster in the Visual Studio.</p>
<p>But, sometimes you just have lots of interrelated projects. If you simply make two copies of the solution and remove half of the projects from one solution, and half from the other, then some of the projects you need when you build will not be in the solution. And, as a result, you will have no Solution Configuration information to tell MSBuild how to build you project.</p>
<p>When this happens, MSBuild uses the "default" configuration and platform to build the project. If this does not match what you are building, then the wrong thing is built. (This makes me sad. <span style="font-family: Wingdings;">L</span>).</p>
<p>The "default configuration" is defined by the set of properties at the top of each project in the first <span style="color: blue;"><span style="font-family: Consolas; font-size: 10pt;">&lt;<span style="color: #a31515;">PropertyGroup <span style="color: blue;">/&gt;</span></span></span>. <span style="color: #000000;">They appear something like the following:</span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;<span style="color: #a31515;">PropertyGroup<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Configuration<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Configuration)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;">Debug<span style="color: blue;">&lt;/<span style="color: #a31515;">Configuration<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Platform<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Platform)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;">AnyCPU<span style="color: blue;">&lt;/<span style="color: #a31515;">Platform<span style="color: blue;">&gt; </span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp; &nbsp;&nbsp; ...<span style="color: black;"> </span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;/<span style="color: #a31515;">PropertyGroup<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></p>
<p>&nbsp;</p>
<p>This basically says that if the Configuration is blank, use the "default" of "Debug", and if the Platform is blank, use the "default" of "AnyCPU". Since this is the behavior when the Solution Configuration does not contain information about the project being built, the default "Debug|AnyCPU" gets built. If you are building "Release", you still get "Debug" for any of these projects that are not in the solution.</p>
<p>You can of course change the default to anything you want. So, if you want the default to be "Release", you can simply edit this part of the file and change it to the new value.</p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;<span style="color: #a31515;">PropertyGroup<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Configuration<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Configuration)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;"><span style="background-color: yellow;">Release</span><span style="color: blue;">&lt;/<span style="color: #a31515;">Configuration<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Platform<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Platform)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;">AnyCPU<span style="color: blue;">&lt;/<span style="color: #a31515;">Platform<span style="color: blue;">&gt; </span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp; &nbsp;&nbsp; ...<span style="color: black;"> </span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;/<span style="color: #a31515;">PropertyGroup<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></p>
<p>&nbsp;</p>
<p>However, this means that this is the new default (Release) that will be used for <strong>all cases</strong> where the value is not defined in the Solution Configuration. And, you would have to hand edit your project files over and over again every time you wanted to change what you are building.</p>
<p>A more flexible solution is to instead add the following lines:</p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;<span style="color: #a31515;">PropertyGroup<span style="color: blue;">&gt; </span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp; <span style="background-color: yellow;">&lt;!-- Add these two lines --&gt;<span style="color: black;"> </span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;<span style="background-color: yellow;">&lt;<span style="color: #a31515;">Configuration<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Configuration)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;">$(DefaultProjectConfiguration)<span style="color: blue;">&lt;/<span style="color: #a31515;">Configuration<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;<span style="background-color: yellow;">&lt;<span style="color: #a31515;">Platform<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Platform)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;">$(DefaultProjectPlatform)<span style="color: blue;">&lt;/<span style="color: #a31515;">Platform<span style="color: blue;">&gt;</span></span></span></span></span></span></span></span></span></span></span></span></span> </span></p>
<p style="background: white; margin-left: 36pt;">&nbsp;</p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Configuration<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Configuration)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;">Debug<span style="color: blue;">&lt;/<span style="color: #a31515;">Configuration<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Platform<span style="color: blue;">&nbsp;<span style="color: red;">Condition<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">&nbsp;'$(Platform)'&nbsp;==&nbsp;''&nbsp;<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;">AnyCPU<span style="color: blue;">&lt;/<span style="color: #a31515;">Platform<span style="color: blue;">&gt; </span></span></span></span></span></span></span></span></span></span></span></span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp; &nbsp;&nbsp; ...<span style="color: black;"> </span></span></p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;/<span style="color: #a31515;">PropertyGroup<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></p>
<p>&nbsp;</p>
<p>By doing this, you can specify "/p:DefaultProjectConfiguration=Release" on the command line, which will then be used for all projects in the build where there is no "Solution Configuration" information. You can also specify "/p:DefaultProjectPlatform=AnyCPU" to set the default platform. (Note that this is less useful, since certain projects may need to build for a specific platform.)</p>
<p>Note that this does not change the existing behavior when $(DefaultProjectConfiguration) and $(DefaultProjectPlatform) are not supplied. And, you can specify only one of them or both of them on your command line.</p>
<p>This still does not allow you to configure each project individually in the build. But, it does give a lot more flexibility. And, if you really need to set the exact Configuration and Platform for a project, the Solution Configuration is the correct place to do this. But, this means that these types of projects would need to be contained in the Solution being built.</p>
<p>Hope this helps&hellip;</p>]]></content:encoded>
    </item>
    <item>
      <title>Rules for Riding</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/rules-for-riding</link>
      <pubDate>Fri, 10 Jun 2011 08:39:00 GMT</pubDate>
      <dc:creator><![CDATA[Chuck England - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2011/06/10/rules-for-riding/</guid>
      <description><![CDATA[DISCLAIMER: Use these rules at your own risk, or don't use them at all. I make no statement of their...]]></description>
      <content:encoded><![CDATA[<p><strong>DISCLAIMER</strong>: Use these rules at your own risk, or don't use them at all. I make no statement of their suitability to your riding style. I certainly take no liability for your using them. And, even following them does not guarantee you want have an accident. And, not having the feedback loop involved with talking to you about them personally, I have no way to&nbsp;ascertain that you understand them as presented. If you choose to follow them, you assume all responsibility for yourself, and those you ride with, and those who ride with you, and anyone you share these rules with. Riding is risky business. You should always take a motorcycle safety class before riding on the street. And always remember Riding Rules #1-3! </p>
<p>The following are rules that helped me when I first started to ride. They were given to me as advice upon buying my first street bike. The BMW dealer spent a great deal of time with me before I got on the road. I have found that (minus one or two duds) all motorcycle dealers seem to really love what they do. And,&nbsp;they are great about&nbsp;spending time with you; and I don't mean in the "used car salesman" kind of way. There must be something about riding that attracts friendly and interesting people.</p>
<p>BMW dealers especially seem to have this nailed. They are a truly special group of folks. They are dedicated to fun and safety. And they know their bikes and their quirks inside and out. It is quite a different experience from the auto dealers.</p>
<p>When I purchased my first street bike in 2000, I had already been riding dirt bikes for years. But this did not prepare me for riding on the road. Not in the least. The salesman, and great friend for years after, gave me these basic lists. As I recall, he started the day I walked into the store. I would stop by on the weekend and admire the bikes, checkout the new models, and plot and plan how to sell this to my wife. <span style="font-family: Wingdings;">J</span> </p>
<p style="text-align: center;"><img src="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-07-83-metablogapi/4571.052811_5F00_1539_5F00_RulesforRid1.jpg" /> </p>
<p style="text-align: center;"><span style="font-size: 9pt;">My youngest son on my first street bike, "Misty" (BMW R1100R) </span></p>
<p>&nbsp;</p>
<p>Each time I would go in, he would talk to me about one of these rules. He always started from the beginning. Conversation would quickly lead him to where we left off. I am sure he did this with all his customers. There was just a gentle and caring way about him. He knew what we came there to get. And he would feed it to us with a lump of safety. By the time I brought my wife to the store, I knew them by heart.</p>
<h1>Suggestion for Beginners </h1>
<p>Buy something that you can ride. Take your time and learn slowly. Let the lessons sink in. Don't just <em>think</em> you get it; <strong><em>know</em></strong> you get it. If you are thinking of trying something new, try it in an empty parking lot before you try it out on the street. You don't need the biggest fastest bike you can afford. In fact, the Kawasaki Ninja 250 is a great bike to start with. It will give you the same feeling you get when riding bigger bikes, but is a lot safer for beginners. And, it has a high resale value. So, later when you know how to ride, and have some clue of what to look for in a bike, you can trade up. </p>
<h1>Rules before Riding </h1>
<ul>
<li>
<div>You have to pay to play. </div>
<ul>
<li>
<div>I know this sounds like a sales pitch, but it really means "if you can't afford the safety gear, the maintenance on your bike, etc., don't ride!</div>
</li>
</ul>
</li>
<li>
<div>"If you have a $10 head, buy a $10 helmet." Ok, I like this saying, but let me make it clear, buy a high quality helmet that is SNELL approved. The cost a lot. (Suck it up; if you can afford a bike, don't skimp on the helmet.)</div>
<ul>
<li>
<div>Personally, I have not found one yet that covers the cost of my head. But I typically pay right around $600.</div>
</li>
</ul>
</li>
<li>
<div>Always wear complete protective gear. That is: </div>
<ul>
<li>Motorcycle street pants (designed to save your skin if you fall; not regular jeans) </li>
<li>Motorcycle street jacket (designed to save your skin if you fall; not the cool jacket for hanging out) </li>
<li>Safety (some jackets have this built-in now) </li>
<li>Motorcycle street gloves </li>
<li>Motorcycle boots </li>
<li>
<div><a href="https://www.smf.org/">SNELL</a> approved helmet with face shield</div>
<p>* Never ride in tennis shoes, flip flops, loose fitting shoes, etc. </p>
</li>
</ul>
</li>
<li>Read you bikes manual from cover to cover and understand the material in it. Some of it is just cool. The rest of it is important. If you don't have the manual for you bike, call the manufacturer and ask for one. Most will send you one "no charge".</li>
<li>Make sure your bike is ready to ride. All maintenance is up to date. 
<ul>
<li>Never use tire cleaners on motorcyle tires. Sure they make car tires look sweet. But one drop of that stuff on your tires in a turn is disaster. If you really want to wash them, use water. You can use a small amount (teaspoon) laundry deterdent mixed in a lot of water (1 gallon +), but if you do, make sure you get it all off.</li>
</ul>
</li>
<li>Perform a preflight checklist everytime you ride. Your bike most likely comes with a checklist in the owners manual. Use it. Some obvious things are: 
<ul>
<li>Check the tire pressure</li>
<li>Check tires for oil or other resdue</li>
<li>Make sure you have enough gas to get where you are going; especially if you are going on the interstate</li>
</ul>
</li>
<li>Always take foul weather gear with you. If you ignore this rule, and foul weather comes, get off the road and wait for it to clear. And overpass makes a great place to wait out the rain. Just make sure you get your bike and gear clearly off and away from the road.</li>
</ul>
<p>Here are some of the items I use when riding: </p>
<ul>
<li><a href="https://www.firstgear-usa.com/Pants/CSSHTAirOverpants.html">First Gear Riding Pants</a></li>
<li><a href="https://www.shoei-helmets.com/Helmet.aspx?Multitec&amp;h=13&amp;t=1" title="SHOEI Multitec Helmet">SHOEI Multitec Helmet</a></li>
<li><a href="https://www.bmwmotorcycles.com" title="BMW Airflow 2 Gloves">BMW Airflow 2 Gloves</a></li>
</ul>
<p>&nbsp;</p>
<p style="text-align: center;"><img src="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-07-83-metablogapi/1351.052811_5F00_1539_5F00_RulesforRid2.png" /></p>
<p style="text-align: center;">My current bike&nbsp;"Annabel" is a BMW K1200RS&nbsp;</p>
<h1>Rules for Riding</h1>
<p>To be successful, you must incorporate your own riding style, type of bike, etc. with these rules. These rules did not come naturally to me. I spent months learning on slow back roads with no traffic. Build you confidence and know your capabilities before you get into a situation that requires them. When you are applying these rules correctly, the feeling is a very natural and fluid motion. If it does not feel right, it is probably not. Most of these rules were given to me. A few I have learned on my own. If I find more, or recall more in my old age, I will&nbsp;do my best to add them here.&nbsp;I hope these rules help you as much as they have helped me.</p>
<ol>
<li>Everyone in a car, truck, or other type of vehicle wants to kill you. Keep your eye on them and avoid them. Remember that between you and vehicle, you lose every time. </li>
<li>Everyone in a car, truck, or other type of vehicle wants to kill you. Keep your eye on them and avoid them. Remember that between you and vehicle, you lose every time. </li>
<li>Everyone in a car, truck, or other type of vehicle wants to kill you. Keep your eye on them and avoid them. Remember that between you and vehicle, you lose every time. </li>
<li>Always ride below your capability.</li>
<li>Between you an another vehicle, the other vehicle wins 100% of the time. Do not get into a situation where you challenge another vehicle.</li>
<li>Bikes turn by <strong>counter steering</strong>. Pressing gently forward on the grip to the side in the direction you want to go will cause the bike to dip (fall over)&nbsp;in that direction.&nbsp;The bike turns by leaning. You accomplish the amount of lean by causing the bike to dip. You cannot steer a bike by <strong>you</strong> leaning. (There was a great TV episode of&nbsp;one of the myth&nbsp;bustnig type shows on this.)&nbsp;It is a gyroscope, and it will resist you. You must lean the bike by pressing the grips.</li>
<li>Keep your head up. This is especially true in the turn where there is a tendency to dip you head.</li>
<li>Always be aware with what is going on around you. Track all vehicles in your mind. Use your peripheral vision. When in doubt, look again before proceeding.</li>
<li>Imagine a line in front of you that follows the path that you want the bike to follow. Focus your eyes about 50 feet in front at a point on that line. (You will have to look farther ahead if you are going faster and closer to you if you are going slower, but 50 feet is a good starting point.) Follow that point with your eyes and head. If your head turns left, the bike will turn left. If your head turns right, the bike will turn right. Remember rule 6. This will become natural with practice. Remember rule 5. </li>
<li>The back brake is to turn on the red light on the back of the bike to warn those following you. It will have little effect at stopping you. </li>
<li>Never use the front brake while in a turn. In an emergency you will need to stop turning first, then apply the front brake hard but gradually. </li>
<li>Weight balance matters. Shift you weight to the side of the seat where you will be turning. This lowers the center of gravity during the turn and pushes it outward toward that side of the bike. The faster and sharper the turn the farther one general tends to push their weight out. The weight shift does not happen during the turn, but before the turn. When done right, the sharpness of the turn matches the weight shift, and it feels like a ballet, with the bike wanting to be held at exactly that lean.</li>
<li>When passing other vehicles on the road, look toward the drivers eyes. If you don't see their eyes, they don't know you are there. If you see their eyes, assume they don't know they are there.</li>
<li>When waiting at a red light at an instersection in a turn lane, and you are not the first in line, before proceeding with the turn, stop at the first spot in line. If a car is turning in front of you, and a car coming the other way does not see you and is timing the gap, you lose.</li>
<li>Never user headphones or listen to music while riding.</li>
<li>Always pay attention. There is a lot think about when riding. (Look at all the rules above.) If you want to admire the view, stop and do that.</li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Batching Resources in MSBuild – Part 1</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/batching-resources-in-msbuild-part-1</link>
      <pubDate>Mon, 06 Jun 2011 15:26:00 GMT</pubDate>
      <dc:creator><![CDATA[Chuck England - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2011/06/06/batching-resources-in-msbuild-part-1/</guid>
      <description><![CDATA[Sometime after Visual Studio 2010 shipped, we received reports about an issue where when targeting...]]></description>
      <content:encoded><![CDATA[<p>Sometime after Visual Studio 2010 shipped, we received reports about an issue where when targeting .NET 3.5, customers were receiving a build error stating that the RESGEN command line was too long. The errors/warnings would look as follows:</p>
<p style="margin-left: 36pt;"><span style="font-family: Consolas; font-size: 9pt;">Error:</span><br /><span style="font-family: Consolas; font-size: 9pt;">The specified task executable "ResGen.exe" could not be run. The filename or extension is too long</span><br /><br /><span style="font-family: Consolas; font-size: 9pt;">Warning:</span><br /><span style="font-family: Consolas; font-size: 9pt;">The command-line for the "ResGen" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "ResGen" into multiple calls with fewer parameters per call.</span></p>
<p>As a result, my team responded with an article to help customers work around the issue:</p>
<p style="margin-left: 36pt;"><a href="https://blogs.msdn.com/b/visualstudio/archive/2010/02/16/if-your-build-fails-with-msb6002-the-command-line-for-the-resgen-task-is-too-long.aspx">https://blogs.msdn.com/b/visualstudio/archive/2010/02/16/if-your-build-fails-with-msb6002-the-command-line-for-the-resgen-task-is-too-long.aspx</a></p>
<p>This article provides several different approaches for fixing the issue. One of these involves changing your targets file to override the GenerateResource target.</p>
<h2>Approaches to fixing issues for shipped targets</h2>
<p>The article above suggests that you can update your Microsoft installed "Common" targets file ("<span style="font-family: Consolas; font-size: 9pt;">%WinDir%\Microsoft.net\Framework\v4.0.30128\Microsoft.Common.targets</span>") with an updated one. (And notes <strong>you should backup</strong> prior to doing so.) But, maybe you don't want to change the Microsoft installed file. There are a couple of other options.</p>
<ol style="margin-left: 54pt;">
<li>
<div>In MSBuild, the last target of a given name found in the project file wins. That is, we only keep that last one defined, and the rest are thrown out. So, to override this target, all you have to do is place an import (<span style="font-family: Consolas; font-size: 9pt;">Imports</span> are processed like C++ #include's) at the bottom of your project file so that is last thing in the file, and then override the functionality in the existing <span style="font-family: Consolas; font-size: 9pt;">GenerateResource</span> target with your own.</div>
<p>This option is the simplest. But, it only affects the one project that you add the import. You also start to run into problems quickly if you want to locate a target. You can define your own property</p>
</li>
<li>
<div>You can use the new functionality in MSBuild to carefully place a new target file you write into a location known to MSBuild, and we will auto-magically pick it up and add it as an import when we load any project file.</div>
<p>This option requires the same targets changes, but you have to place the target in the "special" location. Additionally, debugging will be harder. But, once in place, it fixes the problem for all project files in one fell swoop. To deploy this across a group, and build server, you will have to install these targets on each machine individually.</p>
</li>
</ol>
<h2>How does option #2 work?</h2>
<p>In the Microsoft.Common.targets file, at the very bottom, you will see something that looks like this:</p>
<pre style="background: white; color: black; font-family: Consolas;"><span style="color: blue;">&nbsp;&nbsp;&lt;</span><span style="color: #a31515;">Import</span><span style="color: blue;">&nbsp;</span><span style="color: red;">Project</span><span style="color: blue;">=</span>"<span style="color: blue;">$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*</span>"
<span style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: red;">Condition</span><span style="color: blue;">=</span>"<span style="color: blue;">'$(ImportByWildcardAfterMicrosoftCommonTargets)'&nbsp;==&nbsp;'true'</span>
<span style="color: blue;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and&nbsp;Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')</span>"<span style="color: blue;">&nbsp;/&gt;</span></pre>
<p>This import basically says, if I find a file in the MSBuild folder in a special location (see below), then I will load it after this file. The special location is defined by the MSBuild properties as follows: (the values are from my box, and could vary on the installation)</p>
<table style="border-width: 0px; border-color: #ffffff; padding-left: 30px; background-color: #dbdbdb;" border="0">
<tbody>
<tr>
<td><span style="font-family: Consolas; font-size: 9pt;">$(<span style="color: #993300;">MSBuildExtensionsPath</span>)</span></td>
<td>The MSBuild folder in "<span style="font-family: Consolas; font-size: 9pt;">Program Files</span>" (or "<span style="font-family: Consolas; font-size: 9pt;">Program Files (x86)</span>" on a 64-bit box). For example: "<strong><span style="font-family: Consolas; font-size: 9pt;">C:\Program Files (x86)\MSBuild</span></strong>"</td>
</tr>
<tr>
<td><span style="font-family: Consolas; font-size: 9pt;">$(<span style="color: #993300;">MSBuildToolsVersion</span>)</span></td>
<td>The version of the MSBuild tools to use when building the project. For example "<span style="font-family: Consolas; font-size: 9pt;">3.5</span>" or "<span style="font-family: Consolas; font-size: 9pt;">4.0</span>"</td>
</tr>
<tr>
<td><span style="font-family: Consolas; font-size: 9pt;">$(<span style="color: #993300;">MSBuildThisFile</span>)</span></td>
<td>The name of the current file. For the above example, "<span style="font-family: Consolas; font-size: 9pt;">Microsoft.Common.targets</span>"</td>
</tr>
</tbody>
</table>
<p style="margin-left: 36pt;"><br />So, the final path would be: "<strong><span style="font-family: Consolas; font-size: 9pt;">C:\Program Files (x86)\MSBuild\4.0\Microsoft.Common.targets\ImportAfter</span></strong>" for this scenario.</p>
<h2>Note on paths:</h2>
<p>MSBuild uses all environment variables (which are allowed to be XML node names) as properties inside MSBuild. There are some very nice shortcuts that allow you to get to things you might commonly need. An example I used above was the Windows directory, which was the start of the path to the "Microsoft.Common.targets" file. The environment variable is "%WinDir%", and is not case sensitive. There are a few nice features this environment variable provides:</p>
<ol>
<li>It supplies the path to the Windows folder, which may be on another drive. It is prefixed with the appropriate drive letter as needed. On my machine it is "C:\Windows".</li>
<li>I can use the environment variable in explorer to quickly get to a known location. So, if you click in the location text box in an explorer windows, and type "%WinDir%" (without the quotes) and press enter, you will be taken to your Windows folder.</li>
<li>Since it's an environment variable, it becomes a property in MSBuild, so in MSBuild I can reference this path as $(WinDir).</li>
</ol>
<p>Some of the other ones I use a lot:</p>
<div style="margin-left: 30pt;">
<table style="border-collapse: collapse;" border="0"><colgroup><col style="width: 132px;" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col style="width: 127px;" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col style="width: 339px;" /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /><col /></colgroup>
<tbody valign="top">
<tr>
<td style="padding-left: 7px; padding-right: 7px; border: solid 0.5pt;">
<p><strong>Environment</strong></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: solid 0.5pt; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p><strong>MSBuild</strong></p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: solid 0.5pt; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p><strong>Description</strong></p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%AppData%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(AppData)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of the users roaming profile</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%DevEnvDir%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(DevEnvDir)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of Visual Studio main folder</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%FrameworkDir%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(FrameworkDir)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of .NET Framework root folder</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%HomePath%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(HomePath)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of the users root folder</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%LocalAppData%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(LocalAppData)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of the users local profile</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%ProgramFiles%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(ProgramFiles)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of the 32-bit "Program Files" folder</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%ProgramW6432%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(ProgramW6432)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of the 64-bit "Program Files" folder (only on 64-bit box)</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%TEMP%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(TEMP)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of the users temp folder</p>
</td>
</tr>
<tr>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: solid 0.5pt; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>%WindowsSdkDir%</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>$(WindowsSdkDir)</p>
</td>
<td style="padding-left: 7px; padding-right: 7px; border-top: none; border-left: none; border-bottom: solid 0.5pt; border-right: solid 0.5pt;">
<p>Location of the currently selected Windows SDK</p>
</td>
</tr>
</tbody>
</table>
</div>
<p>&nbsp;</p>
<p>Here is a sample MSBuild file I wrote that uses them:</p>
<p style="background: white; margin-left: 36pt;"><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;<span style="color: #a31515;">Project<span style="color: blue;">&nbsp;<span style="color: red;">xmlns<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">https://schemas.microsoft.com/developer/msbuild/2003<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&lt;<span style="color: #a31515;">Target<span style="color: blue;">&nbsp;<span style="color: red;">Name<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">Build<span style="color: black;">"<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">AppData&nbsp;==&nbsp;'$(AppData)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">LocalAppData&nbsp;==&nbsp;'$(LocalAppData)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">DevEnvDir&nbsp;==&nbsp;'$(DevEnvDir)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">FrameworkDir&nbsp;==&nbsp;'$(FrameworkDir)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">HomePath&nbsp;==&nbsp;'$(HomePath)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">ProgramFiles&nbsp;==&nbsp;'$(ProgramFiles)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">ProgramW6432&nbsp;==&nbsp;'$(ProgramW6432)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">TEMP&nbsp;==&nbsp;'$(TEMP)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&lt;<span style="color: #a31515;">Message<span style="color: blue;">&nbsp;<span style="color: red;">Text<span style="color: blue;">=<span style="color: black;">"<span style="color: blue;">WindowsSdkDir&nbsp;==&nbsp;'$(WindowsSdkDir)'<span style="color: black;">"<span style="color: blue;">&nbsp;/&gt;<span style="color: black;"> </span></span></span></span></span></span></span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&nbsp;&nbsp;&lt;/<span style="color: #a31515;">Target<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span><br /><span style="color: blue; font-family: Consolas; font-size: 10pt;">&lt;/<span style="color: #a31515;">Project<span style="color: blue;">&gt;<span style="color: black;"> </span></span></span></span></p>
<p>And here is the output I generated&hellip;</p>
<p style="margin-left: 36pt;"><img src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/07/83/metablogapi/6874.060611_2226_BatchingRes1.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-07-83-metablogapi/6874.060611_5F00_2226_5F00_BatchingRes1.png" /></p>
<h2>Next up&hellip;</h2>
<p>In the next article, I will show you how I came up with the Batching Solution for RESGEN. Note that the article shown above on the Visual Studio blog has the batching solution in it. The purpose of my article will be to show you how you could have effectively figured this out yourself.</p>]]></content:encoded>
    </item>
    <item>
      <title>Shameless Plug</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/shameless-plug</link>
      <pubDate>Wed, 25 May 2011 20:41:05 GMT</pubDate>
      <dc:creator><![CDATA[Chuck England - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2011/05/25/shameless-plug/</guid>
      <description><![CDATA[I work in Redmond on what used to be called the Visual Studio Platform (VSP) during the development...]]></description>
      <content:encoded><![CDATA[<p>I work in Redmond on what used to be called the <a href="https://blogs.msdn.com/b/visualstudio/">Visual Studio</a> Platform (VSP) during the development of Visual Studio 2010. We are referred to as the platform, as we provide the common set of APIs and services inside Visual Studio that allow other developers to create great editors, designers, language experiences, etc. that provide developers an awesome RAD development environment.
</p><p>As a result of working at the center of the Visual Studio universe, I am blessed to work with the finest, brightest, fun, and passionate software architects, designers, developers, testers, and program managers on the planet. Yes, really. <span style="font-family:Wingdings">J</span>
	</p><p>And they have so many incredible ideas and such drive that they continue to give when common mortals would go home and just watch the <a href="https://www.nhl.com/cup/">Stanley Cup</a> (go <a href="https://canucks.nhl.com/">Vancouver</a>!). When I first got to Microsoft, a great dev lead told me that "we only work half days here, what you do with the other 12 hours is your business."
</p><p>But, these folks, they just seem to be an endless pool of energy. Even when we know that there is only so much that we can do in a given release, they stay late, fix one more bug, close one more issue. Do they go home then?
</p><p>Nope. Instead they work on features and ideas that we did not have time to fully flush out and test. The things that we wanted to provide to our customers, but just could not fit into the schedule.
</p><p>I wanted to cite a couple of instances of this type of work.
</p><p>First, if you know about <a href="https://msdn.microsoft.com/en-us/library/dd393574.aspx">MSBuild</a>, then you know what a cool build system we have. But, when a poll was taken quite some time back on the MSBuild Blog, users replied that they wanted an MSBuild debugger. Early in Visual Studio 2010, we realized that there was no way, with all of the features that we needed to push out the door, that we could also build and test the MSBuild debugger. But, Dan, one of the developers of MSBuild, took his off time and wrote a debugger for MSBuild, and integrated it into Visual Studio. Now, if you read our press release, you would never see this feature listed. In fact, the feature is kind of hidden. We had to do this because what we ship has to go through rigorous testing. And while the development work was done, the testing work simply could not be done. So, this feature silently shipped in the product in a "silent" state. If you want to use it, here are some articles from the author that will tell you all about it.
</p><ul><li><a href="https://blogs.msdn.com/b/msbuild/archive/2010/07/06/debugging-msbuild-script-with-visual-studio.aspx">Debugging MSBuild script with Visual Studio</a>
		</li><li><a href="https://blogs.msdn.com/b/msbuild/archive/2010/07/09/debugging-msbuild-script-with-visual-studio-2.aspx">Debugging MSBuild script with Visual Studio (2)</a>
		</li><li><a href="https://blogs.msdn.com/b/msbuild/archive/2010/07/09/debugging-msbuild-script-with-visual-studio-3.aspx">Debugging MSBuild script with Visual Studio (3)</a>
		</li></ul><p>Second, there are so many features that are really just simple things that help you, our customers, with your day to day jobs. And, they make the Visual Studio experience that much better. Well, and this was a team effort, a bunch of the developers and testers throughout Visual Studio go together and built a bunch of power tools for Visual Studio 2010. They are called the <a href="https://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef/">Pro Power Tools</a>, and are available from the Extension Manager (a new feature available in the Tools menu of Visual Studio 2010). Check them out.
</p><p>Thanks for support Visual Studio!</p>]]></content:encoded>
    </item>
    <item>
      <title>You Can’t Always Get What You Want, You Get What You Need</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/you-cant-always-get-what-you-want-you-get-what-you-need</link>
      <pubDate>Wed, 25 May 2011 20:06:45 GMT</pubDate>
      <dc:creator><![CDATA[Chuck England - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2011/05/25/you-cant-always-get-what-you-want-you-get-what-you-need/</guid>
      <description><![CDATA[I get a lot of feedback from customers on Assembly Resolution. It normally comes in the form of "I...]]></description>
      <content:encoded><![CDATA[<p>I get a lot of feedback from customers on Assembly Resolution. It normally comes in the form of "I can't get the reference I want in my project". And more often than not, I find that what they want is really not what they want at all. Instead, a myriad of confusion and lore have clouded the way. This post will hopefully dispel the myths.
</p><p>While we could start at the beginning, let's start at the end and work backwards toward a better understanding. And, we can start with our real expectation. We expect that when we write an app that references other assemblies, that those assemblies can be found and are loaded as needed by our code such that we can execute the code in them. That is pretty simple.
</p><h1>Runtime Binding
</h1><p>At runtime, our code is loaded into a process. At this point, all of the static references that we have made are resolved.
</p><p>Most of this work is handled by the binder in the CLR. The binder (aka Fusion or CLR loader) cracks open the referencing assembly or EXE to obtain its manifest. The manifest contains a list of all the assemblies that are being referenced. For example, a 2.0 entry might have a reference like:
</p><p style="margin-left: 36pt"><span style="font-family:Consolas; font-size:10pt">.assembly extern System
</span></p><p style="margin-left: 36pt"><span style="font-family:Consolas; font-size:10pt">{
</span></p><p style="margin-left: 36pt"><span style="font-family:Consolas; font-size:10pt">  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
</span></p><p style="margin-left: 36pt"><span style="font-family:Consolas; font-size:10pt">  .ver 2:0:0:0
</span></p><p style="margin-left: 36pt"><span style="font-family:Consolas; font-size:10pt">}
</span></p><p>The entry above is one I pulled out of a random assembly on my disk, and references the System assembly. To get this, <a href="https://msdn.microsoft.com/en-us/library/f7dy01k1(v=VS.100).aspx">I used ILDASM.exe</a> to open the assembly and double-clicked on the manifest.
</p><p>It specifies the public key token and the specific version that needs to be loaded. The binder uses this information to then locate the assembly and bind to it. (The algorithm for binding is <a href="https://blogs.msdn.com/b/chuckeng/archive/2011/05/19/not-the-whole-solution.aspx">documented here</a>.) Since the manifest explicitly calls out each assembly it references, all that needs to be done is to find it and bind to it. And the binder does this work for us.
</p><p>But, there are times when you may need to load an assembly on the fly. Dynamic assembly binding can be done through Assembly.Load(…) and Assembly.LoadFrom(…). <a href="https://blogs.msdn.com/b/chuckeng/archive/2011/05/19/not-the-whole-solution.aspx">Suzanne Cook's old blog has a lot of good notes on this</a>. To call them, you need to know the assembly you want. The locating and binding, just like the static case, is handled for you.
</p><p>The important thing to note at this point is that we already know the assembly that we want to bind to; as it was stored in the assembly's manifest.
</p><p>Note: If you have built your assembly, and you are having trouble getting the assembly to load, you can <a href="https://blogs.msdn.com/b/suzcook/archive/2003/05/29/57120.aspx">use FusLogVw.exe to debug the issue</a>. (<a href="https://msdn.microsoft.com/en-us/library/e74a18c4(v=VS.100).aspx">FusLogVw docs are here</a>) These are issues with the binder probing for the assembly and not finding it.
</p><h1>Assembly Resolution
</h1><p>So, how do we just know the assembly that we want? Well, obviously this starts with a need for some library or piece of code that we want to run. (Duh!) But, how does the manifest get its list of assemblies?
</p><p>This answer is that assemblies are resolved at build time through a process called RAR (Resolve Assembly References). And other references such as COM references and the like are resolved through similar mechanisms such as RCR (Resolve COM References). The resolution process takes the name of the library that you requested and finds the reference that you need.
</p><p>Why does RAR need to do anything? I just told you what I want! To discuss why this is, lets first talk about multi-targeting, and then it should become clear.
</p><h1>Targeting
</h1><p>Targeting is the term we use to describe the fact that your software will run on some specific device or machine. Now, a long time ago, there may have been only one version of a Framework, or one version of DOS, Windows, etc. that you might want to run your application on. And generally, each version of Windows tries to be backwards compatible with the last. So, unless you are using some new feature, you are good to go. But, how do you know? What machines will your software run on? If there is only one target, then "no problem", everything you can code should just work. This was true at the release of .NET v2.0 and Visual Studio 2005.
</p><p>Note that the targeting problem is to make sure that if you run the software on a target machine, we have:
</p><ol><li>Built the software for that target environment
</li><li>That the code that you are using is available on the target
</li></ol><p>And, to simplify things, we are not including the architecture (x86, x64, etc.) of the machine that you are targeting for this discussion. We are really only considering the target runtime environment.
</p><h2>Pseudo Multi-Targeting
</h2><p>With the release of Visual Studio 2008 and .NET Framework v3.5, there were suddenly two (2) frameworks that you could choose from. There was the .NET Framework v2.0 and the new .NET Framework v3.5. Note that both of these frameworks actually run on a single CLR (Common Language Runtime); the v2.0 CLR to be specific. The difference between these two frameworks is basically the new set of functionality delivered in v3.5, which included the new LINQ functionality and the Entity Framework. As a result, Visual Studio 2008 introduced a new concept that we now call "pseudo multi-targeting" which allowed you to specify that you wanted to target v2.0 or v3.5.
</p><p>At compile time, if you had selected to target v2.0 and you attempted to use something that was only available in v3.5, you would get a compiler error. This allowed you to specifically target the 2.0 framework and be sure that you would not load up you app and find that the machine you were running on did not have the required components to run your application.
</p><p>For assembly resolution, this means that a company might provide two different components in their SDK. One of those components might be for v2.0, and the other might use new features in v3.5, and as a result have a dependency on the v3.5 framework.
</p><h2>Real Multi-Targeting
</h2><p>In Visual Studio 2010, things got quite a bit more complex. With this release, the new .NET Framework v4.0 was release. And with it came a new CLR v4.0. This means that the CLR that the design time environment is running on, may not be the same as the actual runtime environment. This is where "real" multi-targeting kicked in.
</p><p>With Visual Studio 2010, you can target .NET Framework v2.0. If you build you app and run it, it will always run on a machine that has .NET v2.0 installed on it. If you target v4.0, your app will have the 4.0 CLR reference, and hence will not run on v2.0. But, you will be able to use all the cool new features and changes in .NET v4.0. (for example, the new parallel Task library)
</p><p>At this point, I think you pretty much get the idea. At build time, the process determines what you are targeting, and takes the reference that you have requested, and looks at the SDKs and components installed on your machine, and it selectively chooses the right assembly to match you target environment. Then, after having figured out all the specific references that you need, we pass those to the compiler, who then makes sure that you don't right code against some feature that won't be available when you go to run your application.
</p><p>The rules for how we do the actual resolution are very specific, and they are, to be fair, quite complicated. But, with Visual Studio, you don't need to worry about that. When you go to the Add Reference dialog, you select an assembly or project from one of the tabs. We then write down your choice in the project file. When we build the project, we select the references for you based on what is the best selection for your target. If you later change your mind and re-target your application to something else, there is no need to fix up any of the references. You rebuild the project, and we then select the right references for the new target, and voila.
</p><h2>Add Reference
</h2><p>I hear this all the time, that "the Add Reference dialog is a Window to the GAC". It is not. The GAC is a runtime mechanism. However, we will look for items in the GAC for resolution as needed. In the Add Reference dialog, we very specifically show you the Framework assemblies for the target framework, and the matching registered SDK assemblies (as specified in <a href="https://msdn.microsoft.com/en-us/library/wkze6zky(v=VS.100).aspx">AssemblyFoldersEx</a>).
</p><p>You can also add what we refer to as a "P2P" or Project to Project reference from the Add Reference dialog. This will get you a reference to another project in your build. We also use this in MSBuild to determine the dependencies so we know what to build first. (And I would not recommend the use of Solution Dependencies. But, that's another article.)
</p><p>If you literally have an assembly that you can't reference any other way, given to you by another developer for example, then you can put it in your project folder or in a sub-folder. (although I don't recommend the "bin" folder as I blow this directory away all the time, and then you won't have your reference; plus if you put it in source control it's a nightmare) Next, use the Browse button in the Add Reference dialog to add the reference to it. This will use a HintPath to specify where the file is. Since it's not registered on the machine (that is, not part of an SDK and hence registered appropriately in AssemblyFoldersEx), then we really don't have any information to go on regarding multi-targeting. As a result, you are pretty much on your own if things go wrong at runtime. And the warnings and errors you may bet at build time when things really go wrong are confusing at best if you are not sure what you are doing. Don't get me wrong, this should work just fine, it's just not the preferred way of doing things.
</p><h2>Conclusion
</h2><p>I get lots of feedback from customers about issues with referencing. Most of the time the issues I see are related to the fact that we did a poor job, in my mind, of explaining how this all works. As a result, there are a lot of folks out there attempting to force a specific version of a reference, using HintPath, and other such nonsense to get their project to build. In reality, for referencing, "less is more". If you tell us you are targeting a specific framework, and you give us a reference like "System.Drawing", we will find the write "System.Drawing" to match you needs.
</p><p>And actually, if you tell us you want to reference "System.Drawing, version=4.0.30319, Culture=neutral, PublicKeyToken=b77a5c561934e089" and you are targeting .NET v2.0, we will politely give you a warning, and give you the one that goes with the v2.0 framework. In this case we know that right version because we know all about the frameworks and what assemblies are the ones for specific framework targets. For third party assemblies supplied in SDKs, we only have limited information. But, either you will get an error when you compile your code, or worse, your application will fall over when you try to run it in the target environment.
</p><p>So, leave the resolution to us. Let Visual Studio use the short name for an assembly. Don't use HintPath unless you have no other way to specify the reference, and realize that your off the beaten path, and you are not protected by multi-targeting.</p>]]></content:encoded>
    </item>
    <item>
      <title>Not the whole solution</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/not-the-whole-solution</link>
      <pubDate>Thu, 19 May 2011 00:17:55 GMT</pubDate>
      <dc:creator><![CDATA[Chuck England - MSFT]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2011/05/19/not-the-whole-solution/</guid>
      <description><![CDATA[A common misconception I hear a lot is that MSBuild knows how to build Visual Studio solutions....]]></description>
      <content:encoded><![CDATA[<p>A common misconception I hear a lot is that MSBuild knows how to build Visual Studio solutions. Technically this is not true, while in earnest it is true.
</p><p>MSBuild understands enough about solution files to translate them into MSBuild project files. When MSBuild is launch, it checks the extension of the project it has been asked to build. If it sees that the file you are building has the extension ".sln", it runs a conversion on that file to create a ".metaproj" file. This metaproj is really just a translation of the solution file into MSBuild project file format. Note that you normally never see this file, as it is only generated in memory.
</p><p>If you want to take a look at the gory details inside the metaproj, you can set the environment variable "MSBuildEmitSolution" to "1" and MSBuild will write the file out with the name "{solutionname}.sln.metaproj".
</p><p style="margin-left: 36pt"><span style="font-family:Consolas">SET MSBuildEmitSolution=1
</span></p><p>Once this is set, just run you build as normal to generate the metaproj file.
</p><p>One thing to note is that since MSBuild is translating the solution file into a project file, there are things that may not be translated correctly. There are also things that simply may not be definable in the MSBuild language. One such beast is the set of solution dependencies. I typically recommend that users steer clear of these, and instead opt for P2P (or project to project) references. But, that is a topic for another article.</p>]]></content:encoded>
    </item>
    <item>
      <title>Hello, world.</title>
      <link>https://docs.microsoft.com/archive/blogs/chuckeng/hello-world</link>
      <pubDate>Fri, 11 Jul 2008 12:29:00 GMT</pubDate>
      <dc:creator><![CDATA[codekitty]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/chuckeng/2008/07/11/hello-world/</guid>
      <description><![CDATA[Welcome to my blog.
&nbsp;The bits you will see here will most likely revolve around my work here...]]></description>
      <content:encoded><![CDATA[<P>Welcome to my blog.</P>
<P>&nbsp;The bits you will see here will most likely revolve around my work here at Microsoft with MSBuild.</P>
<P>&nbsp;I invite questions. So feel free to reply to this post, and I will do my best to get answers.</P>
<P>Chuck</P>]]></content:encoded>
    </item>
  </channel>
</rss>