Restoring and updating native packages

Topics: Ecosystem, General
Aug 9, 2014 at 2:00 PM
is it supposed to work? when restoring and updating from within VS everything works as expected but once I'm trying to restore from command line I get the following line when updating:
WARNING: Could not install package 'NativePackageName.redist 2.7.342'. You
are trying to install this package into a project that targets '.NETFramework,Ve
rsion=v4.0', but the package does not contain any assembly references or content
files that are compatible with that framework. For more information, contact th
e package author.
It makes the previously installed package useless since it destroys the target file (no include folder defined)
Am I doing something wrong?
Aug 10, 2014 at 1:38 PM
UPD:
Looks like a nugget (or CoApp) bug
Steps to repro:
Create new project (Win32 console application)
Use package manager to add any native package, for example cpprestsdk, it will add version 2.1.0
Alter the package.config file to contain previous version of aforementioned SDK, for example 2.0.1
Close the solution, open command prompt
type following:
nuget.exe restore ConsoleApplication1.sln
it will restore cpprestsdk version 2.0.1
now run nuget.exe update ConsoleApplication1.sln -Verbosity detailed
you will get
WARNING: System.InvalidOperationException: Could not install package 'cpprestsdk
2.1.0'. You are trying to install this package into a project that targets '.NE
TFramework,Version=v4.0', but the package does not contain any assembly referenc
es or content files that are compatible with that framework. For more informatio
n, contact the package author.
at NuGet.ProjectManager.ExtractPackageFilesToProject(IPackage package)
at NuGet.ProjectManager.AddPackageReferenceToProject(IPackage package)
at NuGet.ProjectManager.Execute(PackageOperation operation)
at NuGet.ProjectManager.Execute(IPackage package, IPackageOperationResolver r
esolver)
at NuGet.ProjectManager.AddPackageReference(IPackage package, Boolean ignoreD
ependencies, Boolean allowPrereleaseVersions)
at NuGet.ProjectManager.UpdatePackageReference(String packageId, Func`1 resol
vePackage, Boolean updateDependencies, Boolean allowPrereleaseVersions, Boolean
targetVersionSetExplicitly)
at NuGet.ProjectManager.UpdatePackageReference(String packageId, SemanticVers
ion version, Boolean updateDependencies, Boolean allowPrereleaseVersions)
at NuGet.Commands.UpdateCommand.UpdatePackages(IPackageRepository localReposi
tory, IFileSystem sharedRepositoryFileSystem, ISharedPackageRepository sharedPac
kageRepository, IPackageRepository sourceRepository, IPackageConstraintProvider
constraintProvider, IPackagePathResolver pathResolver, IProjectSystem project)