title: Silverlight unable to resolve References when switching from Debug to Release
body: <p>I am using: Silverlight Version 4.0, 100% F# solution.  I am having an issue when switching the Target Configuration from <strong>debug</strong> to <strong>release</strong>.  Everything compiles fine in debug mode, then in release I get the following:</p>
  
  <blockquote>
    <p>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
    warning MSB3245: Could not resolve
    this reference. Could not locate the
    assembly
    "System.ComponentModel.DataAnnotations".
    Check to make sure the assembly exists
    on disk. If this reference is required
    by your code, you may get compilation
    errors.</p>
    
    <p>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
    warning MSB3245: Could not resolve
    this reference. Could not locate the
    assembly
    "System.Windows.Controls.Data.Input".
    Check to make sure the assembly exists
    on disk. If this reference is required
    by your code, you may get compilation
    errors.</p>
  </blockquote>
  
  <p>The Item group in the project file lokos like:</p>
  
  <pre><code>  &lt;ItemGroup&gt;
      &lt;Reference Include="FSharp.PowerPack"&gt;
        &lt;HintPath&gt;C:\Program Files\FSharpPowerPack-2.0.0.0\Silverlight\v3.0\FSharp.PowerPack.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="mscorlib" /&gt;
      &lt;Reference Include="FSharp.Core"&gt;
        &lt;HintPath&gt;$(ProgramFiles)\Microsoft F#\Silverlight\Libraries\Client\$(SilverlightVersion)\FSharp.Core.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System" /&gt;
      &lt;Reference Include="System.ComponentModel.DataAnnotations" /&gt;
      &lt;Reference Include="System.Core" /&gt;
      &lt;Reference Include="System.Net" /&gt;
      &lt;Reference Include="System.Runtime.Serialization" /&gt;
      &lt;Reference Include="System.Windows" /&gt;
      &lt;Reference Include="System.Windows.Browser" /&gt;
      &lt;Reference Include="System.Windows.Controls"&gt;
        &lt;HintPath&gt;bin\Debug\System.Windows.Controls.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Windows.Controls.Data"&gt;
        &lt;HintPath&gt;bin\Debug\System.Windows.Controls.Data.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Windows.Controls.Data.Input" /&gt;
      &lt;Reference Include="System.Windows.Controls.DataVisualization.Toolkit"&gt;
        &lt;HintPath&gt;bin\Debug\System.Windows.Controls.DataVisualization.Toolkit.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Windows.Controls.Input"&gt;
        &lt;HintPath&gt;c:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.Input.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Windows.Controls.Layout.Toolkit"&gt;
        &lt;HintPath&gt;bin\Debug\System.Windows.Controls.Layout.Toolkit.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Windows.Controls.Navigation"&gt;
        &lt;HintPath&gt;bin\Debug\System.Windows.Controls.Navigation.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Windows.Controls.Toolkit"&gt;
        &lt;HintPath&gt;bin\Debug\System.Windows.Controls.Toolkit.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Windows.Data"&gt;
        &lt;HintPath&gt;bin\Debug\System.Windows.Data.dll&lt;/HintPath&gt;
      &lt;/Reference&gt;
      &lt;Reference Include="System.Xml" /&gt;
    &lt;/ItemGroup&gt;
  </code></pre>
  
  <p>Obviuosly some Elements have HintPaths while others do not, and while some have hintpaths there appear to be absolute and relative paths... </p>
  
  <p>Can anybody help me out?  Thanks in advance.</p>
  
  <hr>
  
  <p>OK so I removed the references and then readded them and they came into the project file in the format of:</p>
  
  <blockquote>
    <p>
    c:\Program Files\Microsoft
    SDKs\Silverlight\v4.0\Libraries\Client\System.ComponentModel.DataAnnotations.dll
    </p>
  </blockquote>
  
  <p>for both of the references. It all compiles - in both versions.  Any hint on th HintPaths?  How they are used and how and when they are generated? And why when I tried to modify the proj file by hand it didn't seem to matter (still didn't compile even though VS told me it reloaded)?</p>
  
  <p>Thx</p>