Failed to import "$ (VSToolsPath) \ ..."

I'm trying to create an existing ASP.NET solution on Mono using xbuild, and among the errors I get is the first one (cropped and formatted to match):

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" 

I am relatively unaware of what happens with the creation of .NET projects, but it seems clear that VSToolsPath does not seem to work, so file links (goals?) Cannot be found. When I was working with the search engine, I came across only the older answers, which said that in some (now old) versions of Mono, you had to copy this folder from one place to another - which seemed like a simple pass. The strange thing is that I seem to have this folder in the file system, but 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 

What gives?


Obviously, the “MyProj” above is a shorthand version of a longer file path, such as /Users/John.Smith/projects/MyProj/ .

0
source share
1 answer

It turned out that I have one folder in the version of 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 

As you can see from the output in my question, only some of them actually have VS Tools. It's strange for Xamarin to forget VS2012 and VS2015, but oh well.

The problem disappeared when I copied a new existing version of the folder to those who do not have 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/ 
+1
source

Source: https://habr.com/ru/post/915621/


All Articles