Earlier we discussed an issue with portable class library references when a project is retargeted to a different framework version. The issue was discussed here. It was subsequently reported to Microsoft on Connect. The issue was that portable class libraries have restrictions when we add their reference to a target project. But if a project's target framework is updated after we have added a portable class library reference then we don't know what references of PCLs do we need to update. Later it was improved a little to provide visual cue for invalid PCL references.
Let's use the same NugetPackageRestoreEx console application created in the previous post. The project has Ninject nuget package referenced.
When the package was installed to the project, the project was targeting .net framework 4.5, hence all the required references were also targeting the same framework version. The world is really a happy place.
Now let us retarget the project to .net framework 3.5 from the property page of the project.
As we retarget the project, the nuget package references might become invalid. Nuget 2.7 added a new feature to help in this case. As soon as we retarget the project, there is a build error generated and the Errors List window is displayed with the details about the possible error.
The update has also added a new attribute to the packages.config schema. This is also notified in packages.config stating that you would require a re-installation of this package as per the updated targeted framework version of the project.
The error is transformed into a warning as we rebuild the project. Since the developer has been notified with the possible risk, it should be fine.
Download
Tuesday, September 3, 2013
Project Retargeting Framework Version and Nuget Package Installation
Labels:
.net framework .net framework 4.5,
C#,
nuget,
Package,
retargeting
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment