- Build on windows using Microsoft .NET as per usual
- Build using mono on windows
- Build using mono on linux
- Use nuget package restore on all three
Installing the latest version of mono
Windows:
- Download the 3.x from http://www.go-mono.com/mono-downloads/download.html
- Create dmcs.bat in C:\Program Files (x86)\Mono-3.0.10\bin as this is missing in the latest download
- See https://bugzilla.xamarin.com/show_bug.cgi?id=8813
REM dmcs.bat compatibility shim for mcs
@echo off
call mcs -sdk:4 %*
- See http://www.meebey.net/posts/mono_3.0_preview_debian_ubuntu_packages/
- Add this line to your /etc/apt/sources.list file:
deb http://debian.meebey.net/experimental/mono /
apt-get update
apt-get install mono-complete
Creating a mono solution and projects
Mono’s xbuild is not yet 100% compatible with msbuild. MonoDevelop is also not 100% compatible with the VS 2012 solution/project format. So to make my life easier I’ve written a simple C# script that generates mono solutions and projects from the VS2012 ones.
This is pretty simple and works really well. It also means I can easily have separate output folders for the windows and mono binaries.
Get the source from my gist at https://gist.github.com/andrevdm/5655285#file-updateprojectfileversion-cs
Getting NuGet & package restore working on linux
Import the required certificates
See http://stackoverflow.com/questions/15181888/nuget-on-linux-error-getting-response-stream/16589218#comment24184791_16589218
sudo mozroots --import --machine --sync
- sudo certmgr -ssl -m https://go.microsoft.com
- sudo certmgr -ssl -m https://nugetgallery.blob.core.windows.net
- sudo certmgr -ssl -m https://nuget.org
- Create a mono specific NuGet.target
- See http://nuget.codeplex.com/SourceControl/changeset/view/0b1e224884a3#src/Build/NuGet.targets
- Or use my version (minor modifications) that works with the project generator above
https://gist.github.com/andrevdm/5660800#file-nuget-mono-targets
- http://www.lextm.com/2013/01/how-to-use-nuget-on-mono-part-i.html
- http://www.lextm.com/2013/01/how-to-use-nuget-on-mono-part-ii.html
- http://www.lextm.com/2013/02/debugging-on-mono-xbuild-issue.html
Build scripts
Finally to wrap it all up here are build scripts for linux and windows
Linux
#!/bin/bash
export EnableNuGetPackageRestore=true
mono ./makeMonoProjectsAndSln.exe MySolution.sln
xbuild /p:TargetFrameworkProfile="" MySolution.mono.sln
Windows
@echo off
makeMonoProjectsAndSln.exe MySolution.sln
"C:\Program Files (x86)\Mono-3.0.10\bin\xbuild.bat" /p:TargetFrameworkProfile="" MySolution.mono.sln
No comments:
Post a Comment