Now when installing into a project that does not target net40 then this dependency should not be resolved or used. However the addin does try to resolve this and will fail if it cannot find this dependency.
------- Managing...Test 1.0 -------
Attempting to resolve dependency 'MyDependency (= 1.0)'.
Unable to resolve dependency 'MyDependency (= 1.0)'.
System.InvalidOperationException: Unable to resolve dependency 'MyDependency (= 1.0)'.
at NuGet.InstallWalker.OnDependencyResolveError (NuGet.PackageDependency dependency) [0x00000] in <filename unknown>:0
at NuGet.PackageWalker.Walk (IPackage package) [0x00000] in <filename unknown>:0
at NuGet.InstallWalker.ResolveOperations (IPackage package) [0x00000] in <filename unknown>:0
at ICSharpCode.PackageManagement.SharpDevelopPackageManager.GetInstallPackageOperations (IPackage package, ICSharpCode.PackageManagement.InstallPackageAction installAction) [0x00000] in <filename unknown>:0
at ICSharpCode.PackageManagement.PackageManagementProject.GetInstallPackageOperations (IPackage package, ICSharpCode.PackageManagement.InstallPackageAction installAction) [0x00000] in <filename unknown>:0
at ICSharpCode.PackageManagement.PackageViewModel.GetPackagesRequiringLicenseAcceptance (IPackageManagementSelectedProject selectedProject) [0x00000] in <filename unknown>:0
at ICSharpCode.PackageManagement.PackageViewModel.CanInstallPackage (IPackageManagementSelectedProject selectedProject) [0x00000] in <filename unknown>:0
at ICSharpCode.PackageManagement.PackageViewModel.CanInstallPackage (IList`1 projects) [0x00000] in <filename unknown>:0
at ICSharpCode.PackageManagement.PackageViewModel.InstallPackagesForSelectedProjects (IList`1 projects) [0x00000] in <filename unknown>:0
at ICSharpCode.PackageManagement.PackageViewModel.TryInstallingPackagesForSelectedProjects (IList`1 projects) [0x00000] in <filename unknown>:0
==============================
I suspect it is because the project target framework is not being passed to the InstallWalker which would allow it to ignore the dependency based on the project's target framework.
A NuGet package can specify a dependency on another NuGet package when a particular target framework is being installed:
Now when installing into a project that does not target net40 then this dependency should not be resolved or used. However the addin does try to resolve this and will fail if it cannot find this dependency.
I suspect it is because the project target framework is not being passed to the InstallWalker which would allow it to ignore the dependency based on the project's target framework.