Name: xamarin-windows
Owner: Xamarin
Description: Provides reusable MSBuild tasks and sample Visual Studio tooling for building and debugging Mono AOT compiled binaries
Created: 2017-01-04 20:40:48.0
Updated: 2018-05-24 12:54:19.0
Pushed: 2018-05-24 12:54:18.0
Size: 147
Language: C#
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Goals for this project:
In order to build this project you'll need:
NOTE: Windows has a problem with long (> 260 characters) paths. To avoid
any issues related to this limitation when building this project you should
make sure to checkout this repository in a shallow path on your system. E.g.
to C:\xw
:
:\
clone git@github.com:xamarin/xamarin-windows.git xw
w
To build the project just run the build.cmd
script.
When developing on this project you may prefer to run the individual steps
carried out by build.cmd
manually.
For a manual build you will need Cygwin installed. Consult the Compiling Mono on Windows documentation for more details on the prerequisites.
The commands below asumes Visual Studio 2017 Enterprise is installed. This is not required. Adjust the paths to Visual Studio according to the specific flavor of your Visual Studio 2017 installation.
:\xw
submodule update --init --recursive
By default a mono checkout is expected in mono/external
. Create a
Xamarin.Windows.Override.props
file in the root of the xamarin-windows
checkout with a MonoDevRoot
property to override the path to the mono
checkout.
NOTE: A specific mono commit is expected to be checked out. Check the
MonoCommit
property in the Xamarin.Windows.props
file.
Run from within cygwin:
ath/to/mono
checkout <commit>
togen.sh --host=x86_64-w64-mingw32 --disable-boehm --with-runtime_preset=winaot
rt MONO_EXECUTABLE="`cygpath -u -a msvc\\\build\\\sgen\\\x64\\\bin\\\Release\\\mono-sgen.exe`"
rt VC_ROOT="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC"
rt CLANG2_VERSION=$(sed -n 1p "$VC_ROOT/Auxiliary/Build/Microsoft.ClangC2Version.default.txt" | sed 's/\s//g')
rt VCTOOLS_VERSION=$(sed -n 1p "$VC_ROOT/Auxiliary/Build/Microsoft.VCToolsVersion.default.txt" | sed 's/\s//g')
rt PATH="$VC_ROOT/Tools/ClangC2/$CLANG2_VERSION/bin/HostX64":"$VC_ROOT/Tools/MSVC/$VCTOOLS_VERSION/bin/HostX64/x64":$PATH
drive/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/2017/Enterprise/MSBuild/15.0/Bin/MSBuild.exe /p:PlatformToolset=v140 /p:Platform=x64 /p:Configuration=Release /p:MONO_TARGET_GC=sgen msvc/mono.sln
-C mcs/
The VS extension relies on the Mono BCL to be present in the
build/ReferenceAssemblies/
folder. Run the following to copy the relevant
files:
:\xw
Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" msbuild\CopyReferenceAssembliesFromMonoDevRoot.proj
The VS extension relies on the MSBuild files and the mono installation being
installed in build/MSBuild/
. Run the following to copy the relevant files:
:\xw
Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" msbuild\CreateToolchain.proj
You should now be able to open the Xamarin.Windows.sln
solution and build
it.
NOTE! For now, Xamarin needs to be installed in Visual Studio. Make sure to enable that in the Visual Studio setup.
At this time VS extensions with embedded MSBuild files or Reference Assemblies
are not properly deployed to the experimental instance. We need to setup
symbolic linkes to make sure the VS process correctly loads the MSBuild and
Reference Assemblies from the $MSBuild
and $ReferenceAssemblies
folders
located inside the extension folder in the experimental instance folder. The
mk-vs-experimental-links.bat
script in the root of the source tree creates
these links (must be run as Administrator):
:\xw
s-experimental-links.bat
It should now be possible to debug the extension in VS. NOTE! These links have to be recreated whenever the VS extension's verison number changes. The version number is based on the number of commits so make sure to run the script after new files have been committed or pulled.
Edit the .csproj
file to make it a Xamarin.Windows project. The line
ort Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
must be changed to
ort Project="$(MSBuildExtensionsPath)\Xamarin\Windows\Xamarin.Windows.CSharp.targets" />
Then add the line
jectTypeGuids>{8F3E2DF0-C35C-4265-82FC-BEA011F4A7ED};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
to the first <ProjectGroup>
section in the .csproj
file.