I am developing a library(nupkg
) in .net core targeting both net45
and netstandard1.3
and at some point I need to use reflection so my project.json
looks like this:
{
"version": "1.1.3",
"dependencies": {
common-dependencies
}
},
"frameworks": {
"net45": {
"frameworkAssemblies": {
"System.Reflection": "4.0.0.0"
},
"dependencies": {
"NLog": "4.3.5",
"Newtonsoft.Json": "6.0.4"
}
},
"netstandard1.3": {
"imports": "dnxcore50",
"dependencies": {
"NETStandard.Library": "1.6.0",
"System.Reflection.TypeExtensions": "4.1.0",
"Newtonsoft.Json": "8.0.2",
"NLog": "4.4.0-*"
}
}
}
}
Most of the times after a mere install-package my-package
everything works like a charm, however a couple of times I get this error on installing:
install-package : Failed to add reference. The package 'my-Package' tried to add a framework reference to 'System.Reflection' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
I've found a workaround, which is to uninstall-package
every other package on the project I want to install my package. This is very odd and undesired behavior I think.
I do have noticed however that on some of those project had different versions of Newtonsoft.Json
installed on different projects. This is a warning I also get when installation fails:
Install failed. Rolling back...
Package 'my-package : Newtonsoft.Json [6.0.4, ), NLog [4.3.5, )' does not exist in project 'Target.Project'
I have no idea what could be going on here, and the fact that it happens randomly and the workaround to fix it don't help much.
Any ideas please?
Aucun commentaire:
Enregistrer un commentaire