我尝试编译 my project按照以下说明进行操作,因此出现以下错误。
我的脚本;
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
输出;
XBuild 引擎版本 12.0 单声道,版本 3.2.8.0 版权所有 (C) 2005-2013 Various Mono authors
构建于 01/06/2015 18:31:01 开始。
项目“/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln”(默认目标): 目标 ValidateSolutionConfiguration: 构建解决方案配置“调试|任何 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"-资源 “”-RequireConsent -solutionDir“/home/ziyasal/gthb/InfluxDB.Net/” 正在恢复 NuGet 包... 要防止 NuGet 在构建期间下载包,请打开 Visual Studio 选项对话框,单击包管理器节点并取消选中“允许 NuGet 下载” 丢失的包裹'。 目标 PrepareForBuild: 配置:调试平台:AnyCPU 创建目录“bin/Debug/” 创建目录“obj/Debug/” 目标 GetReferenceAssemblyPaths: /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets:警告:无法找到与目标框架名字对象“.NETPortable,Version=v4.0,Profile=Profile344”相对应的框架。框架屁股 embly 引用将从 GAC 解析,这可能不是预期的行为。 /usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets:错误:未安装 PCL 引用程序集。 任务“GetReferenceAssemblyPaths”执行——失败 在项目“/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj”中完成构建目标“GetReferenceAssemblyPaths”。--失败 完成构建项目“/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net/InfluxDB.Net.csproj”。--失败 任务“MSBuild”执行——失败 在项目“/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln”中完成构建目标“Build”。--失败 完成构建项目“/home/ziyasal/gthb/InfluxDB.Net/InfluxDB.Net.sln”。--失败
构建失败。
警告:
/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 目标)->
/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
工作程序集引用将从 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 目标)->
/usr/lib/mono/xbuild/12.0/bin/Microsoft.Common.targets: error : PCL Reference Assemblies not installed.
1 Warning(s)
1 Error(s)
耗时 00:00:03.8459340
最佳答案
最后,我找到了解决方案(解决方法)。我将 .NETPortable (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable) 文件夹从我的 Win 机器复制到 Linux 机器 (/usr/lib/mono/xbuild -框架/).
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
现在编译得很好!
关于linux - 如何解决 Linux 上的 xbuild '.NETPortable,Version=v4.0,Profile=Profile344' 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27805245/