Reputation: 2280
I am having a hard time converting my asp.net (core) app from dnx46 to .netcoreapp1.0 because of two particular dependencies ( Microsoft.Azure.ServiceBus and System.IO.Ports.SerialPort )
Being positive, I'm making the bet that these feature will eventually land on .net core one day.. but in the meantime, I found that converting my app from moniker dnx46 to .netstandard1.3 allows me to resolve the ServiceBus dependency.
Resolving System.IO.Ports.SerialPort however is still an issue and I don't understand how to make this work. I was hoping that importing net462 framework in .netstandard1.3 moniker, would allow to find the System.IO.Ports.SerialPort object but it does not.
What am I missing ?
For reference, there's my project.json :
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"Microsoft.NETCore.Platforms": "1.0.1-*",
"Microsoft.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.0-rc2-final",
[...more stuff...]
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
// To be restored when they'll become available on .net core
// "Microsoft.WindowsAzure.ConfigurationManager": "3.2.1",
// "WindowsAzure.ServiceBus": "3.2.1",
}
},
"netstandard1.3": {
"buildOptions": {
"define": [ "INCLUDE_WINDOWSAZURE_FEATURE" ]
},
// Imports of net462 fixes loading of
// - NewtonSoft.Json
// - System.Runtime.Loader for "Microsoft.NETCore.App"
"imports": [
"net462"
],
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027"
"Microsoft.WindowsAzure.ConfigurationManager": "3.2.1",
"WindowsAzure.ServiceBus": "3.2.1",
}
}
}
}
Upvotes: 0
Views: 653
Reputation: 24525
If you plan on deploying to a windows box and targeting net452
, then simply take on a dependency on net452
. I put together a migration guide to share my upgrading experiences, perhaps it might help? I initially had this misunderstanding that I would take a dependency of netstandard1.*
and then "import": "net4*"
, David Fowler laughed at me and said something to the extent of "dude that's do wrong!". :P
You should change your project.json frameworks
to look like this:
"frameworks": {
"net462": { }
}
Upvotes: 2
Reputation: 42010
Resolving System.IO.Ports.SerialPort however is still an issue and I don't understand how to make this work. I was hoping that importing net462 framework in .netstandard1.3 moniker, would allow to find the System.IO.Ports.SerialPort object but it does not.
You can't reference System.IO.Ports.SerialPort
when targeting .NET Core or .NET Standard, because this contract only exists in the full .NET Desktop framework.
This library might be eventually ported but in the meantime, you'll have to use .NET Desktop (e.g net462
) instead of .NET Core.
Remove netcoreapp1.0
and netstandard1.3
and add net462
and it should work.
Upvotes: 2