3

I have a solution in Visual Studio 2012. It includes two projects for tests, one in F# and one in C#. I have installed NUnit and FsUnit as Nuget packages. After the installation, the references to these assemblies point to the dll's found in the \packages\ folder inside my solution. After I compile the solution, the references change in the F# project and point to the NUnit installed in my C:\Program Files (x86)\ folder and the \bin\Debug\FsUnit.NUnit.dll in my F# project. In the C# project the references keep pointing to the packages folder.

The project builds in Visual Studio and the tests run fine. When I build it in TeamCity it fails as it cannot find NUnit and FsUnit in the F# project.

Any ideas why the reference change when I compile?

Moreover, why the properties of a reference in an F# project contain much less information compared to the ones in a C# project?

Panos
  • 617
  • 7
  • 20
  • 2
    It may be useful to compare the contents of the `` nodes in the .csproj with the .fsproj. I think possibly we fixed F# bugs related to this scenario (NuGet packages and references) post-RC as well (fixes to appear in final release), though I suspect hand-editing the .fsproj may fix it for you now. – Brian Jun 21 '12 at 21:37
  • Thanks Brian, copying the references fixed it, and it stays this way after I compile. – Panos Jun 21 '12 at 22:01

2 Answers2

2

To close this question, and for future reference, the references in the .fsproj were originally

<Reference Include="FsUnit.NUnit, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null">
  <Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
  <Private>True</Private>
</Reference>

Following Brian's advice, I replaced them with the ones from the .csproj below

<Reference Include="FsUnit.NUnit, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
  <HintPath>..\packages\FsUnit.1.1.0.0\Lib\Net40\FsUnit.NUnit.dll</HintPath>
</Reference>
<Reference Include="nunit.framework, Version=2.6.0.12051, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
  <HintPath>..\packages\NUnit.2.6.0.12054\lib\nunit.framework.dll</HintPath>
</Reference>
Panos
  • 617
  • 7
  • 20
2

This seems to be a bug in NuGet that affects only F# projects, and then only in VS 2012. You'll notice that if you ever use NuGet to upgrade to a newer version of NUnit or FSUnit, your HintPaths will once again be stripped from the .fsproj file.

http://nuget.codeplex.com/workitem/2149

Please vote for that issue so it hopefully gets some attention before the final release of VS 2012!

Joel Mueller
  • 28,324
  • 9
  • 63
  • 88
  • Oh, I see from @Brian's comment that it may be a VS issue and not a NuGet issue, and that it might have been fixed in a post-RC build. I hope that's the case. – Joel Mueller Jun 22 '12 at 21:44