How to solve xbuild '.NETPortable,Version=v4.0,Profile=Profile344' issue on Linux
Asked Answered
J

2

6

I tried to compile my project with following instructions so I get following error.

My script;

sudo apt-get install mono-complete  
mozroots --import --sync 
mkdir gthb  
cd gthb/  
git clone https://github.com/ziyasal/InfluxDB.Net.git
cd InfluxDB.Net/   
mono .nuget/NuGet.exe install NUnit.Runners 
mono .nuget/NuGet.exe restore InfluxDB.Net.sln 
xbuild

Output;

XBuild Engine Version 12.0 Mono, Version 3.2.8.0 Copyright (C) 2005-2013 Various Mono authors

Build started 01/06/2015 18:31:01.


Project "/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln" (default target(s)): Target ValidateSolutionConfiguration: Building solution configuration "Debug|Any CPU". Target Build: Project "/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj" (default target(s)): Target RestorePackages: Executing: mono --runtime=v4.0.30319 "/home/ziyasal/gthb/InfluxDB.Net/.nuget/NuGet.exe" install "/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/packages.config" -source "" -RequireConsent -solutionDir "/home/ziyasal/gthb/InfluxDB.Net/" Restoring NuGet packages... To prevent NuGet from downloading packages during build, open the Visual Studio Options dialog, click on the Package Manager node and uncheck 'Allow NuGet to download missing packages'. Target PrepareForBuild: Configuration: Debug Platform: AnyCPU Created directory "bin/Debug/" Created directory "obj/Debug/" Target GetReferenceAssemblyPaths: /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets: warning : Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.0,Profile=Profile344'. Framework ass embly references will be resolved from the GAC, which might not be the intended behavior. /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets: error : PCL Reference Assemblies not installed. Task "GetReferenceAssemblyPaths" execution -- FAILED Done building target "GetReferenceAssemblyPaths" in project "/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj".-- FAILED Done building project "/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj".-- FAILED Task "MSBuild" execution -- FAILED Done building target "Build" in project "/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln".-- FAILED Done building project "/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln".-- FAILED

Build FAILED.

Warnings:

/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln (default targets) -> (Build target) -> /home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj (default targets) -> /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->

    /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets:  warning : Unable to find framework corresponding to the target framework moniker '.NETPortable,Version=v4.0,Profile=Profile344'. Frame

work assembly references will be resolved from the GAC, which might not be the intended behavior.

Errors:

/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln (default targets) -> (Build target) -> /home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj (default targets) -> /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets (GetReferenceAssemblyPaths target) ->

    /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets: error : PCL Reference Assemblies not installed.

     1 Warning(s)
     1 Error(s)

Time Elapsed 00:00:03.8459340

Jupiter answered 6/1, 2015 at 18:55 Comment(0)
J
12

Finally, I found solution (workaround) for this. I copied .NETPortable (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable) folder from my Win box to Linux box (/usr/lib/mono/xbuild-frameworks/).

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys
A7E0328081BFF6A14DA29AA6A19B38D3D831EF

echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee
/etc/apt/sources.list.d/mono-xamarin.list

sudo apt-get update
sudo apt-get install  mono-devel
sudo apt-get install  mono-complete
sudo apt-get install  referenceassemblies-pcl

#Import the root certificates using the mozroots tool
mozroots --import --sync

#UPDATE: referenceassemblies-pcl package installs required profiles!
#####DEPRECATED#######
#I uploaded .NET Portable folder to temporary place.
#sudo apt-get install p7zip-full
#wget https://dl.dropboxusercontent.com/u/33940399/NETPortable.7z

#Override existing
#sudo 7z x NETPortable.7z -o/usr/lib/mono/xbuild-frameworks/ -aoa
#####DEPRECATED#######
mono .nuget/NuGet.exe restore InfluxDB.Net.sln

xbuild

mono packages/NUnit.Runners.2.6.4/tools/nunit-console.exe 
InfluxDB.Net.Tests/bin/Debug/InfluxDB.Net.Tests.dll

It compiles well now!

Jupiter answered 7/1, 2015 at 15:39 Comment(4)
Can you file a bug on bugzilla.xamarin.com for the referenceassemblies-pcl not installing the PCL profiles? I would have expected the referenceassemblies-pcl to install everything you need, but I could be wrong.Savadove
OK I see what the problem is. The referenceassemblies-pcl is based on what Microsoft released and not what Visual Studio installs (nor what is available with Mono on the Mac). The referenceassemblies-pcl is missing profile 344 which is the profile you are using.Savadove
@MattWard Jo just pushed an update of the referenceassemblies-pcl package that includes Profile344.Estefanaestel
@AlexanderKöplinger - Thanks. I was just about to email Jo about it :)Savadove
S
2

The error message indicates that you do not have the Portable Class Library reference assemblies installed.

I would look at using a later version of Mono 3.10 and installing the referenceassemblies-pcl package. There are more detailed instructions on the Mono website about using Mono on Linux.

http://www.mono-project.com/docs/getting-started/install/linux/

Savadove answered 7/1, 2015 at 15:20 Comment(1)
I have installed referenceassemblies-pcl package but I still getting error.Jupiter

© 2022 - 2024 — McMap. All rights reserved.