Webapplication.targets missing when building a MVC4 project in MonoDevelop on OS X 10.7.4
Asked Answered
W

4

9

I am trying to build a test MVC4 project on OS X 10.7.4 using Mono 2.10.9. I created a new empty MVC4 web application in Visual Studio used git to transfer the source code from Windows to Mac OS X. I then ran xbuild for .nuget package restore, but when I build in monodevelop I get a weird error:

/Users/tamasnagy/Developer/Spellbound/Spellbound/Spellbound.csproj: Error: /Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets: Project file could not be imported, it was being imported by /Users/tamasnagy/Developer/Spellbound/Spellbound/Spellbound.csproj: Imported project: "/Library/Frameworks/Mono.framework/Versions/2.10.9/lib/mono/xbuild/Microsoft/VisualStudio/v10.0/WebApplications/Microsoft.WebApplication.targets" does not exist. (Spellbound)

What could this mean? This also happens when I simply create a new MVC project in MonoDevelop and press build. Any ideas?

Waikiki answered 13/5, 2012 at 21:47 Comment(0)
L
1

Mono's MSBuild implementation (xbuild) does not have an implementation of the targets for ASP.NET projects.

You might be able to build in MonoDevelop. Make sure you have the experimental xbuild integration turned off in MonoDevelop preferences.

Lyns answered 14/5, 2012 at 23:33 Comment(1)
If you turn off XBuild/MSBuild don't you loose out on Nuget Package Restore? You've to go back to manually restoring packages right?Bathyscaphe
M
8

Create a symlink:

cd /usr/lib/mono/xbuild/Microsoft/VisualStudio/v9.0

ln -s v9.0 v10.0

I have the same exact ubuntu 12.04 distro on two different computers and could not figure out why mono would compile on one computer and not the other. But oh well, symlink solved the problem.

Mazurka answered 7/1, 2013 at 7:56 Comment(2)
Creating a symlink is probably the neatest solution if you have to use XBuild/MSBuild (which is a good to have when you want goodies like Nuget Package Restore).Bathyscaphe
Same goes for newer versions of Visual Studio: https://mcmap.net/q/1314814/-could-not-import-quot-vstoolspath-quotSkvorak
V
3

Change your csproj file to import v9.0, as so...

<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
Vanadium answered 31/5, 2012 at 14:10 Comment(1)
This doesn't work anymore as MD master insists of changing v9.0 back to v10.0Vanadium
L
1

Mono's MSBuild implementation (xbuild) does not have an implementation of the targets for ASP.NET projects.

You might be able to build in MonoDevelop. Make sure you have the experimental xbuild integration turned off in MonoDevelop preferences.

Lyns answered 14/5, 2012 at 23:33 Comment(1)
If you turn off XBuild/MSBuild don't you loose out on Nuget Package Restore? You've to go back to manually restoring packages right?Bathyscaphe
T
1

I know this is an old question, but it came up when searching for how to use WebApplications.targets on OSX, so it's still worth answering. With the current version of Mono (5.x), Webapplication.targets is included, so now all you have to do, is to set the VSToolsPath, and everything should just work.

If you are using standard bash shell, the .profile file is the place to put it:

export VSToolsPath=/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild/Microsoft/VisualStudio/v15.0/
Tortilla answered 23/8, 2017 at 7:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.