5
votes

I am using: Silverlight Version 4.0, 100% F# solution. I am having an issue when switching the Target Configuration from debug to release. Everything compiles fine in debug mode, then in release I get the following:

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.

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.

The Item group in the project file lokos like:

  <ItemGroup>
    <Reference Include="FSharp.PowerPack">
      <HintPath>C:\Program Files\FSharpPowerPack-2.0.0.0\Silverlight\v3.0\FSharp.PowerPack.dll</HintPath>
    </Reference>
    <Reference Include="mscorlib" />
    <Reference Include="FSharp.Core">
      <HintPath>$(ProgramFiles)\Microsoft F#\Silverlight\Libraries\Client\$(SilverlightVersion)\FSharp.Core.dll</HintPath>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Core" />
    <Reference Include="System.Net" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Windows" />
    <Reference Include="System.Windows.Browser" />
    <Reference Include="System.Windows.Controls">
      <HintPath>bin\Debug\System.Windows.Controls.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Data">
      <HintPath>bin\Debug\System.Windows.Controls.Data.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Data.Input" />
    <Reference Include="System.Windows.Controls.DataVisualization.Toolkit">
      <HintPath>bin\Debug\System.Windows.Controls.DataVisualization.Toolkit.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Input">
      <HintPath>c:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.Windows.Controls.Input.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Layout.Toolkit">
      <HintPath>bin\Debug\System.Windows.Controls.Layout.Toolkit.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Navigation">
      <HintPath>bin\Debug\System.Windows.Controls.Navigation.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Controls.Toolkit">
      <HintPath>bin\Debug\System.Windows.Controls.Toolkit.dll</HintPath>
    </Reference>
    <Reference Include="System.Windows.Data">
      <HintPath>bin\Debug\System.Windows.Data.dll</HintPath>
    </Reference>
    <Reference Include="System.Xml" />
  </ItemGroup>

Obviuosly some Elements have HintPaths while others do not, and while some have hintpaths there appear to be absolute and relative paths...

Can anybody help me out? Thanks in advance.


OK so I removed the references and then readded them and they came into the project file in the format of:

c:\Program Files\Microsoft SDKs\Silverlight\v4.0\Libraries\Client\System.ComponentModel.DataAnnotations.dll

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)?

Thx

2
About the HintPaths, look at this question: stackoverflow.com/questions/1882038/… - herzmeister

2 Answers

1
votes

Sounds like you moved the project from another machine and you don't have the Silverlight Toolkit and the WCF RIA Services installed on your machine.

Clean your solution, close your Visual Studio and install what's missing.

1
votes

FYI, there is a bug in the shipped Microsoft.FSharp.targets that may interact with this. You can add this line

    <FrameworkRegistryBase Condition="'$(TargetFrameworkIdentifier)'=='Silverlight'">Software\Microsoft\Microsoft SDKs\$(TargetFrameworkIdentifier)</FrameworkRegistryBase>

inside a <PropertyGroup> (just below the <Tailcalls> element is a good spot) inside Microsoft.FSharp.targets to fix it. I don't know if this relates to your problem (it sounds like it may not), but just a heads-up in case.

(The fact that you get a HintPath (even if you do things right) may also be the result of a bug in the F# project system.)

One possible strategy if you need a workaround is to check in a copy of DLLs you need to reference in a fixed spot (relative to your projects) under source control, and then reference those DLLs via the 'fixed' relative paths.