无法导入" $(VSToolsPath)\\ ..." [英] Could not import "$(VSToolsPath)\..."

查看:1063
本文介绍了无法导入" $(VSToolsPath)\\ ..."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用xbuild建立在Mono现有的ASP.NET的解决方案,而我得到的错误之一,这是第一个(修整和格式化,以适合):

I am trying to build an existing ASP.NET solution on Mono using xbuild, and among the errors I am getting, this is the first one (trimmed and formatted to fit):

MyProj/OrderQueueJob/OrderQueueJob.csproj: error : 
MyProj/OrderQueueJob/OrderQueueJob.csproj: 
../packages/Microsoft.Web.WebJobs.Publish.1.0.2/tools/webjobs.targets: 
    Project file could not be imported, it was being imported by 
        MyProj/OrderQueueJob/OrderQueueJob.csproj: 
        MyProj/packages/Microsoft.Web.WebJobs.Publish.1.0.2/tools//webjobs.console.targets: 
        Project file could not be imported, it was being imported by 
            MyProj/packages/Microsoft.Web.WebJobs.Publish.1.0.2/tools/webjobs.targets: 
            MyProj/packages/Microsoft.Web.WebJobs.Publish.1.0.2/tools/webjobs.console.targets 
            could not import "$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets"

我以什么进入构建.NET项目相对不知情,但似乎清楚的是,似乎 VSToolsPath 来取消设置,这样引用的文件(目标? )无法找到。当谷歌搜索此我只一经问世即提到,在单声道的一些(现在老了)版本中,你需要这个文件夹从一个位置复制到下一个较旧的答案 - 什么似乎是一个简单的遗漏。奇怪的是,我似乎已经在文件系统中该文件夹,但它不能被发现!

I am relatively unknowing as to what goes into building .NET projects, but it seems clear that the VSToolsPath seems to be unset, so that the referenced files (targets?) cannot be found. When googling this I only came upon older answers that mentioned that in some (now old) versions of Mono you needed to copy this folder from one location to the next - what seemed to be a simple omission. The weird thing is that I seem to have this folder in the file system, yet it cannot be found!

$ find /usr/local/Cellar/mono -iregex '.*VisualStudio.*Microsoft.WebApplication.targets'
/usr/local/Cellar/mono/4.2.2.30/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets
/usr/local/Cellar/mono/4.2.2.30/lib/mono/xbuild/Microsoft/VisualStudio/v11.0/WebApplications/Microsoft.WebApplication.targets
/usr/local/Cellar/mono/4.2.2.30/lib/mono/xbuild/Microsoft/VisualStudio/v9.0/WebApplications/Microsoft.WebApplication.targets

怎么办?

显然,MyProj文上面是一个较长的文件路径的下调版本,如 /Users/John.Smith/projects/MyProj /

Obviously "MyProj" above is a trimmed down version of a longer file path such as /Users/John.Smith/projects/MyProj/.

推荐答案

原来我每次的的Visual Studio版本

ls /usr/local/Cellar/mono/4.2.2.30/lib/mono/xbuild/Microsoft/VisualStudio/
v     v10.0 v11.0 v12.0 v14.0 v9.0

正如你可以从我的问题在输出看到的,只有其中的一些实际上的VS工具。 Xamarin的怪异忘记VS2012和VS2015,但噢,好。

As you can see from the output in my question, only some of these actually have the VS Tools. Weird of Xamarin to forget VS2012 and VS2015, but oh, well.

问题就走了,当我复制该文件夹的最新现有版本到那些失踪了:

The problem went away when I copied the newest existing version of the folder into the ones missing it:

MONO_VS_DIR=/usr/local/Cellar/mono/4.2.2.30/lib/mono/xbuild/Microsoft/VisualStudio
cp -r $MONO_VS_DIR/v11.0/WebApplications $MONO_VS_DIR/v12.0/
cp -r $MONO_VS_DIR/v11.0/WebApplications $MONO_VS_DIR/v14.0/

这篇关于无法导入" $(VSToolsPath)\\ ..."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆