c# - NuGet - Dependee project referencing different DLL according to selected build configuration -
i'm new nuget , researching/proof-of-concept'ing @ moment:
is possible package nuget package in such way dependee project (the 1 has dependency) references different dll according project configuration build?
example:
dependee-debug.dll -> references dependency-debug.dll dependee-release.dll -> references dependecy-release.dll similarly, i'd need repeat behaviour 32-bit/64-bit discrimination. if possible, there tutorial explains how, anywhere? can't find mention of functionality.
you should able reference different assemblies based on current build configuration using either powershell script or using custom msbuild targets file. note using msbuild targets file work cross platform in monodevelop , xamarin studio powershell script not.
nuget allows include msbuild targets file can change happens @ build time. in msbuild targets file can have references , make them conditional based on current build configuration.
in build directory of nuget package add msbuild .targets file same name nuget package id. can have different .targets files particular target framework (e.g. net40) having under net40 subdirectory if need to.
build\mypackageid.targets then in msbuild .targets file can simple such have references conditionally added.
<itemgroup condition=" '$(platform)' == 'x86' "> <reference include="myassembly"> <hintpath>x86\myassembly.dll</hintpath> </reference> </itemgroup> <itemgroup condition=" '$(platform)' == 'x64' "> <reference include="myassembly"> <hintpath>x64\myassembly.dll</hintpath> </reference> </itemgroup>
Comments
Post a Comment