如何在Linux上解决xbuild'.NETPortable,Version = v4.0,Profile = Profile344'问题

ziy*_*sal 6 linux ubuntu mono xbuild portable-class-library

我尝试按照以下说明编译我的项目,因此我得到以下错误.

我的剧本;

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
Run Code Online (Sandbox Code Playgroud)

输出;

XBuild Engine版本12.0 Mono,版本3.2.8.0版权所有(C)2005-2013各种Mono作者

Build build 01/06/2015 18:31:01


项目"/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln"(默认目标):目标ValidateSolutionConfiguration:构建解决方案配置"Debug | Any CPU".目标构建:项目"/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj"(默认目标):目标RestorePackages:执行: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/"恢复NuGet包...为了防止NuGet在构建期间下载包,打开Visual Studio Options对话框,单击Package Manager节点并取消选中'允许NuGet下载丢失的包'.Target PrepareForBuild:配置:调试平台:AnyCPU创建目录"bin/Debug /"创建目录"obj/Debug /"目标GetReferenceAssemblyPaths:/usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets:warning:Unable找到与目标框架名字对象'.NETPortable,Version = v4.0,Profile = Profile344'对应的框架.框架ass embly引用将从GAC解决,这可能不是预期的行为./usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets:错误:未安装PCL参考装配.任务"GetReferenceAssemblyPaths"执行 - FAILED在项目"/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj"./ FAILED Done building project"/ home/ziyasal中完成构建目标"GetReferenceAssemblyPaths" /gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj".-- FAILED任务"MSBuild"执行 - FAILED在项目"/home/ziyasal/gthb/InfluxDB.Net/InfluxDB"中构建目标"Build" .Net.sln".-- FAILED Done building project"/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln".-- FAILED

建立失败.

警告:

/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln(默认目标) - >(构建目标) - > /home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj(默认目标) - > /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
Run Code Online (Sandbox Code Playgroud)

工作程序集引用将从GAC中解析,这可能不是预期的行为.

错误:

/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln(默认目标) - >(构建目标) - > /home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj(默认目标) - > /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)
Run Code Online (Sandbox Code Playgroud)

时间流逝00:00:03.8459340

ziy*_*sal 12

最后,我找到了解决方案(解决方法).我将.NET Box中的.NETPortable(C:\ Program Files(x86)\ Reference Assemblies\Microsoft\Framework.NETPortable)文件夹复制到Linux框(/ 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
Run Code Online (Sandbox Code Playgroud)

它编译好了!