xbuild 和 F# (vs2010) 项目
我有一个 VS 2010 混合语言解决方案,主要是 C#,但包含用 F# 编写的 Windows 服务。我已经在并行环境中使用 xbuild 进行了此构建,但自从从 badgerports< 升级到 mono 2.10.5 的打包版本后/a> 我一直无法让它工作。
我通常遇到的错误是:
/home/alex/git/Solution/FSProject/FSProject.fsproj:错误:在项目中找不到名为“Build”的目标。
让我困惑的是,查看项目文件,似乎没有定义任何目标。我远非 MSBuild 专家,但这对我来说似乎有点奇怪。话虽这么说,它以前确实有效。
有没有人遇到过(并希望找到解决方案)类似的问题?如果可能的话,我希望能够使用 xbuild 和 Visual Studio 构建解决方案。
环境是 mint 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)有助于走到这一步。
I have a VS 2010 mixed-language solution that's primarily C#, but contains a windows service written in F#. I've had this building with xbuild in the in a parallel environment, but since upgrading to the packaged version of mono 2.10.5 from badgerports I've been unable to get it working.
The error I typically encounter is:
/home/alex/git/Solution/FSProject/FSProject.fsproj: error : Target named 'Build' not found in the project.
What puzzles me is that looking at the project file, it doesn't appear that ANY targets are defined. I'm far from an expert on MSBuild, but this seems a bit strange to me. That being said, it did work previously.
Has anyone run into (and hopefully found the solution for) similar issues? If possible I'd like to be able to build the solution with xbuild and from Visual Studio.
Environment is mint 11 (not sure if this is based on ubuntu maverick or natty) running mono 2.10.5 from badgerports. fsharp was installed from latest source to the default prefix.
edit
I've been able to get a little closer thanks to Brian's pointer (I did have to hard-code a path, xbuild seems to have trouble resolving things like "$(MSBuildExtensionsPath32)..\FSharp\1.0\Microsoft.FSharp.Targets"). FSC is actually getting called now, though it's complaining that it's unable to resolve the reference to FSharp.Core.
I found this page F# and XBuild (Debian) helpful in getting this far.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 Mono 3.0.0 或更高版本,则不再需要黑客技术
There's no need for hackery anymore if you use this:
事实证明,并行环境实际上让我的事情变得更轻松。 Mono 安装在 /usr,而 F# 安装在 /usr/local,因此我需要设置符号链接以使 FSharp 目标和 Common 目标能够相互看到。详细信息如下:F# 和 XBuild (Debian)
设置完成后,我仍然遇到麻烦。添加一些调试消息后,我发现 xbuild 无法正确解析 F# 目标的路径。项目文件尝试像这样导入:
并且 xbuild 在解析相对路径时遇到问题。所以我只是将其更改为:
这允许我在命令行上传递 FSharp.targets 的路径。
仍然存在一些问题(它因抱怨 ItemGroups 未注册而失败,我知道这是 xbuild 的一个弱点,但这似乎是一个误报 - 该项目实际上确实构建并成功运行)。希望这对其他人有帮助。
So it turns out that the parallel environment was actually making things easier on me. Mono installs at /usr, while F# installs at /usr/local, so I needed to set up symlinks to enable FSharp targets and Common targets to see each other. This is detailed here: F# and XBuild (Debian)
Once this was set up, I was still having trouble. After adding some debug messages I found that xbuild was not resolving the path to F# targets correctly. Project file was trying to import like this:
and xbuild was having trouble resolving the relative path. So I just changed it to this:
which allows me to passin the path to FSharp.targets on the command line.
There are still a few problems (it's failing with a complaint about ItemGroups not being registered, I know this is a weakness in xbuild but it seems to be a false alarm - the project does in fact get built and run successfully). Hope this helps someone else.