I have several C# code libraries which I recently converted to target .NET Standard 1.4, for use in a Xamarin Forms project as well as many legacy .NET Framework 4.6.1 projects.
I initially added Nuget packages to the .NET Standard class libraries using the Package Reference in Project Files style.
After learning of this bug where transitive package references from .NET Standard projects are not resolved in legacy .NET Framework projects , I tried the workaround of adding <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
to the legacy project's csproj. The legacy projects continued to not resolve the transitive references- that is, the workaround didn't work.
So, I would like to revert to the old style of referencing Nuget packages in a packages.config file in my .NET Standard project.
Manage Nuget Packages
tool window
PackageReference
, not in a packages.config file. Does anyone know how I can force new Nuget packages in my .NET Standard 1.4 project to be listed in packages.config
instead of as Package References?
In addition to removing the PackageReferences from the project file, I also had to remove the following files from the $ProjectDir\\obj
directory:
Close the migrated project.
Copy the project file and packages.config from the backup (typically \\MigrationBackup\\\\) to the project folder. Delete the obj folder if it exists in the project root directory.
Open the project.
Open the Package Manager Console using the Tools > NuGet Package Manager > Package Manager Console menu command.
Run the following command in the Console:
update-package -reinstall
If you haven't already you need to remove this property: <RestoreProjectStyle>PackageReference</RestoreProjectStyle>
And then remove any PackageReferences in your project. Then when you add nuget package references they should go into the package.config file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.