Last post Sep 29, 2016 05:57 PM by PatriceSc
Sep 29, 2016 04:32 PM|jlguitar287|LINK
I'm upgrading a .NET Core web application from RC2 to RTM. It used to use DNX451, but now it uses the dotnet CLI.
Unfortunately, this app has some code that relies on loading a COM library.
var comType = Type.GetTypeFromProgID("ABCCrypto2.Crypto");
This code works when I use:
But I need to deploy this app as a portable (framework dependent) app, so I changed the above json to:
However, when I use netcoreapp1.0, I get the error: 'Type' does not contain a definition for 'GetTypeFromProgID'
1. How can I do a portable deployment while still being able to use Type.GetTypeFromProgID?
2. If question 1 is not possible, is there any other way to load this COM/dll that still allows for me to do a portable deployment?
Thanks so much for the help!
Sep 29, 2016 05:02 PM|PatriceSc|LINK
Wrong target IMO. If you are using COM librairies then to me your app is not portable by design. What does this library can't be replaced with .NET code ? Another option might be to use a web service though it could raise other security concerns. Or even
to accept your app is not portable for now and insulate all this stuff somewhere so that you can later rework this area to make it truly portable.
Sep 29, 2016 05:24 PM|jlguitar287|LINK
Thanks so much for the response. The COM library is an old cryptography library that encrypts and decrypts data.
The problem is we have a legacy site that uses this library. Right now, we have a "hybrid" platform where the legacy site is used in parallel with the updated .NET Core website I'm working on. Both the the legacy site and the .NET Core site uses this COM library.
Even if we could use an updated library (or just .NET code) in for the .NET Core site, I think doing the same thing for the legacy site (which is written in Classic ASP) would be challenging.
Anyways, thanks for the help and suggestions!
Sep 29, 2016 05:57 PM|PatriceSc|LINK
If you can use the same algorithm with the same keys it should produce the same result and I don't see why you would have to update the old site. According to
http://www.websupergoo.com/abccrypto-1.htm it seems it uses RSA. Maybe https://docs.microsoft.com/en-us/dotnet/core/api/system.security.cryptography.rsa#System_Security_Cryptography_RSA_Create would
allow to encrypt the same string with the same keys and get the same encrypted string ?
Else I would go for now for a web service that could be exposed by the old site (my understanding is that both sites are on the same machine).
Or else you have to accept that for now your app is not portable.
Edit: BTW you may want to do a broader review to see if you won't run in similar shortcomings. ASP.NET Core is really brand new and not as mature or feature rich than the current "old" .NET offers and it seems I see quite often in this forum, peer developpers
rushing to Core and realizing along the way that they miss some key features.