Dependencies and Target Framework

Apr 14, 2011 at 10:28 PM

Hi,

My project dependencies depends on the target Framework. 
Is there a way to support that with the current version ?

I'm thinking to a 'targetFramework' attribute on the dependency element (like framework assemblies)

 

- Bruno

Developer
Apr 14, 2011 at 10:41 PM

What are you trying to do? Does your assembly depend on a specific version or is it dependencies and content?

Apr 14, 2011 at 10:45 PM

My package depends on another package for .NET 2.0 but not for SL 4.0

I'm investigating PowerShell script for doing that.
Just need to know how to get the current target framework from the '$project.Object' instance.

 

- Bruno

 

Apr 14, 2011 at 11:29 PM
Edited Apr 15, 2011 at 7:21 AM

Did it using a Install.ps1 file :

 

param($installPath, $toolsPath, $package, $project)

if($project.Properties.Item("TargetFrameworkMoniker").Value.StartsWith(".NETFramework"))
{
 Install-Package AnotherPackage -Version X.Y.Z
}

 

But I still think a 'targetFramework' attribute on the dependency element (like framework assemblies) can be useful.

 

- Bruno

Apr 15, 2011 at 1:21 AM

+1

/kzu from Android

On Apr 14, 2011 8:29 PM, "bbaia" <notifications@codeplex.com> wrote:
> From: bbaia
>
> Did it using a Install.ps1 file : param($installPath, $toolsPath, $package, $project)if($project.Properties.Item("TargetFrameworkMoniker").Value.StartsWith(".NETFramework"))
> {
> Install-Package AnotherPackage -Version X.Y.Z
> } But I still think a 'targetFramework' attribute on the dependency element (like framework assemblies) can be usefull. - Bruno
>
>
Feb 7, 2012 at 7:06 PM

Hello I stumbled upon this and did in fact put a question on stack overflow if it is possible.

http://stackoverflow.com/questions/9150102/nuget-specify-dependency-only-for-specific-target-framework

If you are targetting net40 and sl4/5 you quickly get into such a situation and with winrt it will only get worse since people will probably write anti-corruption APIs to harmonize stuff.

Can anbody say whether this is on the Nuget roadmap or not?

Feb 7, 2012 at 7:13 PM

yes, this is on our roadmap.

Feb 8, 2012 at 4:28 PM

Created Issue 1913 http://nuget.codeplex.com/workitem/1913

Thanks for sharing your scenario with us on this!