0

I am pretty new to C# and .NET and am trying to use a package that depends on .NET 4.6.2 in newer .NET 7 solution. I know it may be obvious but is this possible? I have searched and cannot even find someone that says 'no'. The reason being is that I need to connect to MS CRM 2011 on premises installation and, due to its age, there is not a newer version of the packages available.

Any help would be great, even a 'no, not possible' would suffice. Just hoping maybe there is a way.

I thought maybe there was a way to add a wrapper or something similar to encapsulate the package to make it work?!? Is that stupid?

Tried adding the old packages to the latest solution and I get an error that the build has failed - however, not error message to explain why.

More specifically I am trying to use Microsoft.CrmSDK.CoreAssemblies and other related packages.

  • 1
    err.. .net 4.6.2 is of .net standard line while .net 7 is from .net core line. they are of different breed and some functionalities are not available on the other or behave differently - see this [article](https://learn.microsoft.com/en-us/archive/msdn-magazine/2017/september/net-standard-demystifying-net-core-and-net-standard). if its a prebuilt package I won't take my chances. if you have the sources, you can try to [recompile them](https://stackoverflow.com/a/59401579). – Bagus Tesa May 03 '23 at 08:18
  • also, [this QA might help](https://stackoverflow.com/questions/52970400/using-dynamics-crm-sdk-with-net-core) – Bagus Tesa May 03 '23 at 08:26
  • @BagusTesa - thanks - I said I was new and Core, Standard and Framework confuses me. I wanted a new web api solution in VS. I am given options of .Net7 or .Net8. Thanks for your suggestions I will see if there's sources available. – MarkRugman May 03 '23 at 08:26
  • its ok, microsoft naming schemes for the .net lineage is not exactly bright and causes confusion for sometime. they can "share" the same code (before you compile stuff). but once compiled, swaping them around causes problem(s). – Bagus Tesa May 03 '23 at 08:28
  • @BagusTesa - thanks for the link - however, that's for Dynamics 365 online. I am trying to connect to hosted / on-premises CRM 2011 version. It's all confusing to me why as they are often referred to as same thing :) thanks again. – MarkRugman May 03 '23 at 08:33
  • my bad, i thought they were the same as i'm not familiar with CRM stuffs. guess your best shot if you really wanted it runs on .net core was either to ask microsoft or go leeroy jenkins and decompile the whole thing then recompile it against .net core. – Bagus Tesa May 03 '23 at 08:41
  • Is there a special reason to go for NET 7? I mean you want to use something (CRM2011) that 's way beyond its lifetime and unsupported by now. You may simply use an environment (NET 4.6) that fits that timeline better. You still have the option to go multi process and wrap the CRM2011 stuff in its own Net4.6 process. – Ralf May 03 '23 at 09:49
  • It is technically possible. NET5+ has a bunch of shim assemblies, mscorlib.dll being the canonical example. They don't contain any code, just [TypeForwardedTo] attributes that forwards the version 4 type to their equivalent type in NET5+. They however don't cover all legacy types and sometimes throw a NotImplementedException when there is no substitute. All you can do is try it. – Hans Passant May 03 '23 at 12:31

1 Answers1

0

if your main goal is to connect your .NET 7 app to Dynamics, there are packages for .NET Core/.NET to be able to interact with the CRM. For example, you should try to use Microsoft.PowerPlatform.Dataverse.Client, which is a replacement for CrmSdk packages that are tied to .NET Framework.

You will find a class ServiceClient in the package which serves as a IOrganizationService/IOrganizationServiceAsync client used for communicating and executing requests towards the Dynamics.

Tried adding the old packages to the latest solution and I get an error that the build has failed - however, not error message to explain why.

Yes, the old packages are not compatible with .NET Core/.NET, that's why it's not working.

ssedlacek
  • 58
  • 4