[Mono-dev] building for Mono under msbuild
Andy Waddell
awaddell at fnfr.com
Tue Oct 11 14:49:02 EDT 2005
I have an application that needs to run under both .NET and Mono and I
came up with a pretty simple way to get MS DevStudio to build both. I
don't know how others have solved this problem, but I thought I would
offer it up in case it helps someone else with the same issue. The
basic approach I took was to call the Mono compiler after the Microsoft
build has already run. Microsoft has a well known target "AfterBuild"
which I have hooked to invoke gmcs with pretty much the same arguments
that csc.exe takes with some minor modifications. I put all the Mono
build stuff in a file called Mono.targets, so it only take a one line
addition to the standard *.csproj file to get the functionality:
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
Add this line--> <Import Project="<your path>\Mono.targets" />
This will make your build essentially a dual pass build with all the
Microsoft stuff running and then the Mono compiler running with all the
warnings and erros showing up in the IDE as you would expect. The work
is not complete (I don't pass all the options possible, etc), but I
think it's fairly obvious how to expand it if needed.
I'm sure there are many other ways to skin this cat, but for a quick and
dirty solution, it seems to work pretty well.
ToDo: invesitgate xbuild to do my Linux builds.
--andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051011/001f1371/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mono.targets
Type: application/octet-stream
Size: 2298 bytes
Desc: Mono.targets
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20051011/001f1371/attachment.obj
More information about the Mono-devel-list
mailing list