有没有办法使用xbuild,通过命令行或在构建脚本中,将其他参数传递给编译器?具体来说,我想传入--mcs-debug 1
以获取内部编译器错误的堆栈跟踪.
我能够通过更新来解决它%MONO%\bin\gmcs
,但我希望有更好的方法.
如何使用代码编译Visual Studio 2010
解决方案?xbuild
unsafe
目前我收到此错误:
Implementation/MaximumImageColorClassifier.cs(35,13):错误CS0227:不安全的代码需要指定`unsafe'命令行选项
但是跑步:
xbuild -unsafe [解决方案文件]
要么:
xbuild/unsafe [解决方案文件]
给出错误:
MSBUILD:错误MSBUILD0004:指定的项目文件太多
xbuild
帮助表明这是正确的语法:
xbuild /?... xbuild [options] [project-file]
但是没有unsafe
选项,也没有"通用"选项来提供一些编译标志.
我看到了这个问题:我可以在命令行上通过xbuild将参数传递给msc吗?但它没有明确的答案,也许有一个特定的不安全代码的解决方法?
另外,在我的情况下xbuild
是使用dmcs
编译器.
我正在尝试使用Mono/xbuild在Ubuntu上构建我的SLN
我开始收到与webapplication.targets相关的错误,并认为我修复了这个问题,因为在OS X 10.7.4上在MonoDevelop中构建MVC4项目时,在Webapplication.targets中添加了一个simlink
但现在我得到与以下内容相关的错误:错误:初始化任务时出错错误:无法加载文件或程序集"Microsoft.Build.Tasks.v4.0"或其依赖项之一.
我需要采取哪些特殊步骤来完成这项工作吗?我需要特定版本的Mono吗?
[UPDATE]
看来这是Nuget步骤的一个问题:
azureuser@scratchpad:~/test-api/src/Model$ xbuild Model.csproj
XBuild Engine Version 12.0
Mono, Version 3.2.8.0
Copyright (C) 2005-2013 Various Mono authors
Build started 8/4/2014 11:29:09 AM.
__________________________________________________
Project "/home/azureuser/test-api/src/Model/Model.csproj" (default target(s)):
Target EnsureNuGetPackageBuildImports:
: error : Error initializing task Error: Could not load file or assembly 'Microsoft.Build.Tasks.v4.0' or one of its dependencies. The system cannot find the file specif
ied.
Task "Error" execution -- FAILED
Done building target "EnsureNuGetPackageBuildImports" in project "/home/azureuser/test-api/src/Model/Model.csproj".-- FAILED …
Run Code Online (Sandbox Code Playgroud) 我尝试按照以下说明编译我的项目,因此我得到以下错误.
我的剧本;
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(默认目标) …
我最近为我的新款MacBook下载了Mono 2.我正在试图弄清楚如何用xbuild编译Visual Studio解决方案,xbuild包含在Mono中.有任何想法吗?
是否有人与Mono的xbuild一起使用了MSBuild社区任务或MSBuild扩展包?他们俩似乎都具有MSI安装程序,所以我想这是手动将文件传输到Mac的情况(就我而言)?
如果有人这样做,我将不胜感激他/她的经验。
msbuild mono msbuildcommunitytasks xbuild msbuildextensionpack
我有一个包含16个C#项目的Visual Studio解决方案.我还有一个单独的build.proj
文件,其中包含三个<Target>
s:
Build
,其中包含<MSBuild>
对*.sln 的引用Package
,包含<MakeDir>
和<CopyCommands>
将生成的DLL/EXE文件以及各种数据文件复制到$(StagePath)
目录.Deploy
,将文件从阶段路径复制到部署路径.我能够运行命令xbuild /t:Deploy build.proj
来构建*.sln并将其文件复制到适当的位置,直到最近IT部门决定将我的Documents文件夹移动到网络驱动器上.
现在,每当我尝试运行这个xbuild命令时,我都会遇到类似下面的错误.(引用是同一解决方案中的一个依赖项.)
error CS0234: The type or namespace name `Util' does not exist in the namespace `Contoso'. Are you missing an assembly reference?
Run Code Online (Sandbox Code Playgroud)
但每当我在Xamarin Studio的同一个*.sln上进行"Build All"时,我会得到一个成功的构建,其中包含0个错误和0个警告.那么,如果Xamarin Studio可以,xbuild为什么不能找到这些汇编参考?
我正在尝试为一个项目构建一个自动下载,编译和运行程序,以使Mac和我自己的其他用户更容易使用,因此我们不必随着项目的进行一遍又一遍地做所有事情。我在Google上找不到有关如何使用代码编译和运行C#monodevelop项目的任何信息。这里有人知道怎么做吗?
谢谢
编辑:使用xbuild如下所述编译项目,但我似乎找不到运行生成的命令?唯一的输出似乎是.exe,并且在我尝试运行时会启动vmware,我是否在某处添加了som命令?喜欢执行
tar -xf sources.tar.gz
cd *project*
xbuild project.sln
Run Code Online (Sandbox Code Playgroud) 我有一个VS 2010混合语言解决方案,主要是C#,但包含一个用F#编写的Windows服务.我已经在并行环境中使用了xbuild这个版本,但是自从从badgerports升级到mono 2.10.5的打包版本后,我一直无法使它工作.
我经常遇到的错误是:
/home/alex/git/Solution/FSProject/FSProject.fsproj:错误:在项目中找不到名为"Build"的目标.
令我困惑的是,查看项目文件时,似乎没有定义任何目标.我远不是MSBuild的专家,但这对我来说似乎有点奇怪.话虽如此,它以前确实有效.
有没有人遇到(并希望找到解决方案)类似的问题?如果可能的话,我希望能够使用xbuild和Visual Studio构建解决方案.
环境是薄荷11(不确定这是基于ubuntu maverick还是natty)从badgerports运行mono 2.10.5.fsharp从最新源安装到默认前缀.
编辑
由于Brian的指针(我确实需要硬编码路径,xbuild似乎无法解决像"$(MSBuildExtensionsPath32)..\FSharp\1.0\Microsoft.FSharp.Targets这样的问题,我已经能够更近一点了) ").FSC实际上已经被调用了,虽然它抱怨它无法解析对FSharp.Core的引用.
我发现这个页面F#和XBuild(Debian)有助于实现这一目标.
我想用Mono构建我的VisualStudio 2012解决方案(.sln),但它无法编译依赖于VisualStudio特定程序集的项目.例如
xbuild ServerResource.sln
...
HypervResourceControllerTest.cs(18,17): error CS0234: The type or namespace name `VisualStudio' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Run Code Online (Sandbox Code Playgroud)
在这种情况下,HypervResourceControllerTest.cs(18,17)是对Visual Studio测试工具的引用:
using Microsoft.VisualStudio.TestTools.UnitTesting;
Run Code Online (Sandbox Code Playgroud)
由于我不需要编译测试环境,我可以告诉Mono编译器绕过.sln中的特定项目吗?