Error message in Xamarin Studio: Multiple references to FSharp.Core.dll are not permitted - f#

When I set up a new F# project in Xamarin Studio with a reference to Suave I get an error.
Here are the steps to reproduce the error message:
Create a new solution in Xamarin Studio 6. Type: Console Project in F#
Add the Suave nuget package: Suave 1.1.2
Open Program.fs and add this line on the top of the file: 'open Suave'
After this the word 'open' is decorated with red squiggles and when I move the mouse pointer over it a little pop up appears with this message:
Error: Multiple references to 'FSharp.Core.dll' are not permitted
Why does this error messages come up and how do I remove it?
What I have noticed is that the installation of the Suave nuget package had also caused the installation of the FSharp.Core nuget pakage. Here is the resulting packages.conf file:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FSharp.Core" version="3.1.2.5" targetFramework="net45" />
<package id="Suave" version="1.1.2" targetFramework="net45" />
</packages>

This happens because the Xamarin's F# project template by default references the local copy of FSharp.Core.
Removing the (duplicated) reference should fix the issue.

I just updated Xamarin Studio to ignore the local copy of FSharp.Core if the project contains a reference to a NuGet version. Should be released in XS 6.1 cycle 8.

Related

Using Xamarin in VS2015, "No resource identifier found for attribute 'cardCornerRadius' in package '

I am trying to use recyclerView in my android App with Xamarin in Visual Studio 2015 . And I have added those 3 Nuget packages: Xamarin.Android.Support.v4 Xamarin.Android.Support.v7.CardView Xamarin.Android.Support.v7.RecyclerView Packages
But when I build the project, I encountered these mistakes:
RecyclerViewTutorial\Resources\layout\row.axml(2): error APT0000: No resource identifier found for attribute 'cardCornerRadius' in package 'RecyclerViewTutorial.RecyclerViewTutorial'
I have updated those packages,but the problem is still here.
What can I do now?
The .axml file code is here:
<?xml version="1.0" encoding="utf-8"?>

TeamFoundation 11 Client Libraries in Nuget?

I have inherited a code base that has .dll's in the source code repository.
:::::::Gasssssssssssssssssspppppppp::::::::::
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.Client.dll" "11.0.60315.1 built by: Q11REL"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.Common.dll" "11.0.60315.1"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.dll" "11.0.50727.1"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.WorkItemTracking.Client.dll" "11.0.61030.0"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.Build.Client.dll" "11.0.60315.1"
\ThirdPartyReferences\FromProgramFiles.11.0\Microsoft.TeamFoundation.VersionControl.Common.dll" "11.0.61219.0 built by: Q11REL"
\ThirdPartyReferences\Microsoft.TeamFoundation.Build.Workflow.dll" "11.0.61030.0"
\ThirdPartyReferences\Microsoft.TeamFoundation.TestManagement.Client.dll" "11.0.61030.0"
\ThirdPartyReferences\Microsoft.TeamFoundation.TestImpact.BuildIntegration.dll" "11.0.61030.0"
\ThirdPartyReferences\FromGAC\Microsoft.TeamFoundation.TestImpact.Client.dll" "11.0.61219.0"
I cannot find a Nuget package that houses these.
This package
<package id="Microsoft.TeamFoundation.11" version="11.0.50727.1" targetFramework="net45" />
has these files
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.Client.dll" "11.0.50727.1 built by: RTMREL"
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.Common.dll" "11.0.50727.1"
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.dll" "11.0.50727.1"
\packages\Microsoft.TeamFoundation.11.11.0.50727.1\Microsoft.TeamFoundation.11.0.0.0\lib\Microsoft.TeamFoundation.WorkItemTracking.Client.dll" "11.0.50727.1"
Any idea where to find the others?
You can find the package at nuget.org.
TeamFoundation.11 is located here

F#'s Scaffold and FsUnit/FsCheck

I'm struggling to get started with F# on Linux using ProjectScaffold.
Specifically: I can't get a project to work with FsUnit/FsCheck/xunit. I
have F# 3.1 and mono 3.12.1 and I'm on Linux (Ubuntu) x64.
I start "MyProject" with:
$ git clone --depth=1 git#github.com:fsprojects/ProjectScaffold.git
$ cd ProjectScaffold && ./build.sh
Then I add a bit of code to "src/MyProject/Library.fs":
module MyProject.X
let four = 4
And then two tests to "tests/MyProject.Tests/Tests.fs":
module MyProject.Tests.X
open Xunit
open FsUnit.Xunit
open FsCheck
open FsCheck.Xunit
open MyProject.X
[<Fact>]
let ``Two plus two is four.`` () =
2 + 2 |> should equal four
[<Property>]
let ``Sorting a sorted list is idempotent.`` (l: int list) =
let s = List.sort l
s = List.sort s
This code works on Visual Studio where I manually added FsCheck, FsUnit, anx xunit 1.9.2 (it fails with later version
for some reason). My test project on Windows/Visual Studio has this config file:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FsCheck" version="1.0.4" targetFramework="net45" />
<package id="FsCheck.Xunit" version="1.0.4" targetFramework="net45" />
<package id="FsUnit.xUnit" version="1.3.0.1" targetFramework="net45" />
<package id="xunit" version="1.9.2" targetFramework="net45" />
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
</packages>
So I edit paket.dependencies to add these packages and remove Nunit:
source https://nuget.org/api/v2
nuget FSharp.Formatting 2.8.0
nuget FSharpVSPowerTools.Core 1.7.0
nuget FAKE
nuget FsCheck 1.0.4
nuget FsCheck.Xunit 1.0.4
nuget FsUnit.xUnit 1.3.0.1
nuget xunit 1.9.2
nuget SourceLink.Fake
github fsharp/FAKE modules/Octokit/Octokit.fsx
Then:
$ mono .paket/paket.exe install
...and it fails because NUnit is referenced somewhere, so I delete the references in tests/MyProject.Tests/paket.references and
$ mono .paket/paket.exe install
works, but
$ ./build.sh
fails, at it cannot find references to FsCheck et al. So I assume that I need to add the references manually, so tests/MyProject.Tests/paket.references is now:
FsCheck
FsCheck.Xunit
FsUnit.xUnit
xunit
...built build.sh fails again: it cannot find FsCheck. I could not find in the paket doc how to add a local dependency (MyProject.Tests should reference MyProject), it might be done automatically.
I had this problem and it took a while for me to figure out a fix. For the project file in the Tests directory, I had to change this:
<Reference Include="FsUnit.NUnit">
<HintPath>..\..\packages\FsUnit.1.3.0.1\Lib\Net40\FsUnit.NUnit.dll</HintPath>
<Private>True</Private>
</Reference>
To this:
<Reference Include="FsUnit.NUnit">
<HintPath>..\..\packages\FsUnit\Lib\Net40\FsUnit.NUnit.dll</HintPath>
<Private>True</Private>
</Reference>
Similarly, for NUnit:
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
To:
<Reference Include="nunit.framework">
<HintPath>..\..\packages\NUnit\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
The issue is that on mono, the packages don't have the version in the path but under Visual Studio they do. Once I found this fix, I created two .fsproj files for the tests and I modified the build.sh script to swap the mono-compatible one in when under mono via:
#!/bin/bash
if test "$OS" = "Windows_NT"
then
# no changes in here
else
# fix test fsproj file
mv tests/ProjectName.Tests/ProjectName.Tests.fsproj tests/ProjectName.Tests/ProjectName.Tests.fsproj.vs
mv tests/ProjectName.Tests/ProjectName.Tests.fsproj.mono tests/ProjectName.Tests/ProjectName.Tests.fsproj
# leave the script logic for mono in place
# put project files back to avoid git noticing the swap
mv tests/ProjectName.Tests/ProjectName.Tests.fsproj tests/ProjectName.Tests/ProjectName.Tests.fsproj.mono
mv tests/ProjectName.Tests/ProjectName.Tests.fsproj.vs tests/ProjectName.Tests/ProjectName.Tests.fsproj
fi
Once I made these changes the project works fine under both Visual Studio as well as mono.
I am not quite sure, I understand you: Do you have two fsproj files, one for the production code and one for the unit tests? And are you referencing FsCheck in the fsproj?
Plus, I remember an issue, where if you compile against an older version of .net and reference an assembly compiled against a newer version of .net, it will behave as though there was no reference.

Missing Microsoft.Build.Tasks.v4.0.dll on visual studio online tfs build

I am trying to build my project with visual studio online.
I am getting the following error.
C:\a\src\.nuget\nuget.targets (71): The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll". Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\12.0\bin\amd64\Microsoft.Build.Tasks.v4.0.dll' or one of its dependencies. The system cannot find the file specified.
This is coming from the nuget.targets file in my solution.
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<EnvKey ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
try {
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
}
catch {
}
]]>
</Code>
</Task>
</UsingTask>
I have updated nuget.exe to latest and have not changed anything in nuget.targets.
The problem was that some of the class libraries in the solution had the default value :
ToolsVersion="12.0"
changing that to
ToolsVersion="4.0"
made it work on TFS online
I ran into this after upgrading a project to .NET 4.5.2. Seems to be a conflict between the .NET 4.5 point releases and the old way to do NuGet package restore (MSBuild-Integrated package restore vs Automatic Package Restore).
I was able to solve the issue by migrating NuGet to the new way of doing package restore: http://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore
More info: http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html

TF215097 Custom Build Activities using Com Interop on 64 bitsTF215097: An error occurred w

TF215097: An error occurred while initializing a build for build definition {DefinitionName}: The invocation of the constructor on type 'Classname' that matches the specified binding constraints threw an exception.
OK some had already answered this very well:
TFS 2010 Custom Build Activity TF215097 error
I had the same issue before and corrected them by adding the correct attribute:
Microsoft.TeamFoundation.Build.Client.BuildActivity( Microsoft.TeamFoundation.Build.Client.HostEnvironmentOption.Agent )
My build is running well on x86 machine but give the error on 64 bit build controller or agent.
The Context :
I created several Build Activities. One of this activity is a Visual Build Pro runner activity. I referenced the Visual Build Professional 6 Server Object. (We have several project and could not update it... at this point)
When I build the assembly VS 2010 generate Native.{MyAssemblyName}.manifest
<?xml version="1.0" encoding="utf-8"?>
<assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity name="Native.EMI.TeamFoundation.Build" version="1.0.0.0" type="win32" />
<file name="VisBuildSvr.dll" asmv2:size="712904">
<hash xmlns="urn:schemas-microsoft-com:asm.v2">
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
<dsig:DigestValue>aePKKx7BgE7vN7OjQqwrQ2bvex8=</dsig:DigestValue>
</hash>
<typelib tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" version="1.0" helpdir="C:\Program Files (x86)\VisBuildPro6\System\VisBuildPro.chm" resourceid="0" flags="HASDISKIMAGE" />
<comClass clsid="{d87ad38d-99d9-4e04-9505-696c3afde66c}" threadingModel="Both" tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" progid="VisBuildSvr6.Application" description="Visual Build Pro 6 server application component" />
<comClass clsid="{1cc058ff-793f-4560-9fad-48d88db93ca9}" threadingModel="Free" tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" progid="VisBuildSvr6.Builder" description="Visual Build core builder component (MTA)" />
<comClass clsid="{5ef3f30b-278b-4796-8f23-41fdd5ddc96c}" threadingModel="Both" tlbid="{c48285d5-e97e-4824-9e14-faf8124b00a4}" progid="VisBuildSvr6.BuilderSTA" description="Visual Build core builder component (MTA/STA)" />
</file>
</assembly>
And Interop.VisBuildSvr.dll assembly
When I trig a build on a Windows 64 bit Build Controller and Agent on the same machine I have the TF error.
I tried to attach the debugger on the controller and I am able to see the first error :
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
Additional information: Could not load file or assembly 'Interop.VisBuildSvr, Version=1.0.0.0, Culture=neutral, PublicKeyToken=d64ea679b6fd0408' or one of its dependencies. The system cannot find the file specified.
That file is on my custom assemblies folder on TFS and also on the BuildController and BuildAgent folder.
Thanks
From your comment, it looks like you got it working by configuring your build to invoke the 32-bit version of MSBuild. Is that right?

Resources