-
Notifications
You must be signed in to change notification settings - Fork 0
Consuming wraps from MSBuild
Once a wrap descriptor has been built, it’s time to hook-up your project file to load the dlls at compile time.
OpenWrap provides an MSBuild task responsible for resolving all the required references present in the wrap packages declared in the descriptor.
To make it easier to integrate in a C# msbuild file, OpenWrap also provides an MSBuild target that can replace the standard CSharp target, providing some properties that can quickly modify how a build happens.
The quickest way to import the OpenWrap assembly resolver in your solution is to use the MSBuild target.
First, if you start from a default C# project, you need to shuffle a few things around. This is the recommended folder structure:
- packageName
- wraps contains the wrap packages you will rely on
- openwrap-1.0.0.wrap
- cache
- openwrap-1.0.0
- build
- openwrap-1.0.0
- src contains your source code
- packageName-1.0.0.wrapdesc your descriptor files
- YourProject
- YourProject.csproj
- wraps contains the wrap packages you will rely on
It looks like a lot, but it’s not as bad as it looks.
The /wrap folder is the most important, it will be the repository for all the wrap packages you will use in your solution. It contains a cache folder in which each of the wrap files is automatically uncompressed the first time you use the package. At the very least, you need to have that folder exist, even if it’s empty.
If you’ve installed OpenWrap on your machine, the o shell will be available on your path. The only thing you need to install the OpenWrap package is to execute the following command line while in your project:
o wrap install openwrap
This will autoamtically install the OpenWrap package and decompress it locally.
Once this is done, you can change the following line from YourProject.csproj:
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
with
<Import Project="..\..\..\wraps\openwrap-*\build\OpenWrap.CSharp.targets" />