Microsoft Dynamics CRM - Plugin Running in Context of .NET 4.0 - plugins

I wrote a plugin for Microsoft Dynamics CRM 2011. It runs alongside a bunch of other plugins written by different contractors targeting different versions of .NET.
My plugin targets .NET 4.5. I recently installed .NET 4.5 on the CRM web servers. If a user causes my plugin to fire (Create/Update of account), the plugin runs fine without any issues.
However, when an updates comes from a different plugin, the following error is thrown:
Method not found: 'System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)'
The limited stack trace we've received from the contractor reporting the error says it's occurring within my plugin. I am using Ninject, which I think is the likely culprit. I am guessing that somehow my plugin is being run in a .NET 4.0 environment where this method does not exist.
I am not very familiar with the way CRM runs plugins. Outside of the web servers, do I need to install .NET 4.5 on any other machines? Could this be related to a .NET 4.0 plugin indirectly calling my .NET 4.5 plugin?

Even for crm-2013 Microsoft says that you should use .net 4.0. I think that you are right on the mark when you say that it's the interaction between 4.0 and 4.5 in your plugin. Can you build your project on 4.0? Give it a try and see what happens.

After talking to the company about their CRM setup, they explained there were two servers dedicated to running async plugins. It appears that Microsoft Dynamics CRM always runs the plugins on whatever server initiated the update. Normally, that would be the web servers because the update is initiated by IIS. However, in this case, that would be the async servers. I simply had to install .NET 4.5 on these two servers and the problem went away.

Related

Running 4.6.1 application on 4.8 framework: What issues will I encounter

We currently have a whole suite of applications targeted to framework 4.6.1. These run across our estate, including 400+ remote POS units.
I see that framework 4.6.1 went out of support in April 2022. I need to understand how best to move forward back on to a supported platform.
The obvious issue that comes to mind is security patches. Now that 4.6.1 is unsupported no further security patches will be available potentially opening up our network to vulnerabilities.
This gives me my first thought of installing framework 4.8 on our client machines and letting our applications, still targeted to 4.6.1, run under 4.8.
Will this mean that we will be covered by security patches installed to the 4.8 framework as the runtime will be 4.8, can we get away with NOT retargeting our projects?
The second thought is to install 4.8 on our client machines and re-target the applications to 4.8. We have various different code sets that run together as larger applications but there is also a cross-over between classes within these applications so re-targeting and maintaining compatibility will be a challenge.
Also, how do I identify any regressed functionality between 4.6.1 and 4.8?
Finally, should I look at .NET 5.0?

Deploying .NET Framework 4.5 with Installshield

I have written an application that I deploy via Clickonce, but I want to deploy it via Installshield, so I am experimenting with it. I found and downloaded dotnetfx45_full_x86_x64.exe, the redistributable for .NET Framework 4.5, and made a Installshield prerequisite from it. I wrote a simple application that has a RDLC report that just says “Hello World”, and it needs .NET Framework 4.5, and used Installshield to deploy it. The Reportviewer needs Microsoft SQLClrTypes_x86.msi and SQLClrTypes_x64.msi, and ReportViewer.msi, so I got those and made Installshield prerequisites from them. For the ReportViewer.prq, I specified SQLClrTypes_x86.prq and SQLClrTypes_x64.prq, as dependencies, and for SQLClrTypes_x86.prq and SQLClrTypes_x64.prq I specified dotnetfx45_full_x86_x64.prq as a dependency.
When I installed my little application on my test computer (running Windows 7), it installed the 4.5 framework, said it needed to reboot, and asked if I wanted to reboot now, and I clicked Yes. I was thinking it would reboot and continue the installation, but when it rebooted, that was the end of the installation. I ran setup again, it asked if I wanted to install the 4.5 Framework (it asked me the first time, too), so I clicked No. After clicking No, it installed the rest of my program, and it ran perfectly.
How can I get the installation to continue after it reboots from installing the .NET Framework 4.5?
Thanks
Here's a blog I wrote about 9 years ago:
Using InstallShield 12 to Install .NET Framework 3.0
It hasn't changed much. You want to use the prereq editor to change the reboot behavior to Note it, fail to resume if the machine is rebooted, and reboot after the installation.
Also please note that InstallShield consumes it's PRQ files from the ISProductFolder (C:\Program Files (x86)\InstallShield.... ) I don't care for this from a CM perspective. I recommend isolating the file and file references to relative paths based on ISProjectFolder and keeping all of these files in your source control tool.
Behavior Tab

Enterprise Library 5.0 don't show namespace Microsoft.Practices.EnterpriseLibrary.Data

I was using Visual Studio 2008 with Enterprise Library 4.0. It is working fine and showing namespace Microsoft.Practices.EnterpriseLibrary.Data. Now I installed VS 2010 and Enterprise Library 5.0.(because 4.0 sowsn't support vs 2010 ).
But the problem is Enterprise Library 5.0 doesn't show Microsoft.Practices.EnterpriseLibrary.Data. Is there another namespace in 5.0 thriugh which I can access the Database class which comes under Microsoft.Practices.EnterpriseLibrary.Data namespace?
please let me know.
You are probably targeting .NET Framework Client Profile. The Data Access Block has dependencies on System.Data.Oracle and requires the full .NET Framework.
For anyone else hitting this problem with moving their DAAB-based app to .NET4, entlib5 is supplied with the source code installable via e.g. C:\Program Files (x86)\Microsoft Enterprise Library 5.0\src\Enterprise Library 5.0 - Source Code.msi
Running that msi and accepting the defaults creates a EntLib50Src folder under your Documents area. If you go into EntLib50Src\Blocks\Data and open Data.2010.sln you can change the target framework to .NET Framework 4 Client Profile.
This will create a bunch of errors related to the System.Data.Oracle dependency. Remove the reference to it, and then exclude the Oracle parts of the project and comment out any Oracle references in the common code.
If you then recompile with strong name signing on you can use the output assemblies (Microsoft.Practices.EnterpriseLibrary.Common.dll and Microsoft.Practices.EnterpriseLibrary.Data.dll) with .NET Framework 4 Client Profile. You do have to distribute Microsoft.Practices.Unity.dll from the e.g. C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin area but this is client profile-compatible.
Note that the above works if you're not needing Oracle support in your app. Mine doesn't, its SQL Server and VistaDB only. The above should work with any non-Oracle db compatible with ADO.NET.

Make .NET Framework 4 wpf application portable or more reliable to install

I am required to create a simple application. Since I am good at WPF and I don't know win forms that good I implemented my application by creating a .Net Framework 4.0 WPF project in Visual Studio. Everything works great the application runs like it is supposed to.
Since the application is required to run in multiple platforms (Windows XP and above) I am including the prerequisites when publishing my applications. The prerequisites happen to be:
1) WIC (Windows Imaging Component) old computers need that to run the .net framework 4.0
2) Windows installer 3.1 (needed in order to install the next prerequisite)
3) Windows .NET Framework 4.0 Client Profile
If I install those prerequisites then the application runs like it is supposed to.
Now the problem is:
My boss did not approve my application because he tried installing it in a Windows XP machine with SP2 and this are the things that happened:
Step 1)
// first prerequisite (WIC) took less than 1 minute to install everything
// is working great so far.
Step 2)
// second prerequisite (Windows Installer 3.1) takes about 2 minutes to install
// which is great. After the installation is done the computer needs to be
// restarted in order to continue with the installation. Things are not going
// that good now but we are still ok...
Step 3)
// After the computer is done rebooting it continues with the last prerequisite
// (Windows .NET Framework 4.0 Client Profile). That takes 10 minutes to install!!!!
Step 4)
// My application has all the prerequisites needed to be installed so it installs in
// about 1 minute
We recorded the time, and the application took about 25 minutes to install from start to finish. The computer where we tested the installation was a virtual computer using 2 cores and 1 GB of memory with 3.1 GHZ.
What do you guys recommend in order to speed up this installation? Should I use a different technology such as windows forms using .net 2.0? It will be nice if I can deploy the application that I have already created. If you guys could help me make this application portable I will really appreciate it. In order to do so I tried building my application with all the required references copied to the output directory. That did not work... Or any ideas of how to make the installation be faster will be of great help as well.
If you're using .NET Framework 4.0 (which is not going to come out-of-the-box with any versions of Windows, especially Windows XP) there's no way to get around the install of .NET 4.0 on the target machine. Your major bottleneck is going to be the download of .NET 4.0 files from Microsoft to the machine.
I've run into similar problems where the initial install of an application takes forever because of the .NET 4.0 download and install. We even encountered an issue where the application couldn't be install because there was insufficient disk space for the download.
One option would be to pre-push the prereqs out to all the machines you'll be install this on before deploying your application.
Otherwise, you might be forced to use an older version of the .NET framework. Here's a list of the framework versions which shipped with various versions of windows.
http://blogs.msdn.com/b/astebner/archive/2007/03/14/mailbag-what-version-of-the-net-framework-is-included-in-what-version-of-the-os.aspx
Unfortunately, if your organization is committed to using a 10 year old operating system then they either need to accept that modern tools will require a lengthy install process while all prereqs are loaded... or else force you to use a 10 year old software technolgy.

Missing Project Template after installing ASP.NET MVC 2

I have downloaded the ASP.NET MVC 2 Release version (using Web Platform Installer) as well as the downloading the file directly from the link in WPI. No error messages are reported after the install.
When I go into Visual Web Developer and select Create New project I only the project reference to ASP.NET MVC version 1.0 and not version 2 (for clarity I have all the other project types, this is just in reference to the MVC projects).
I have restarted, uninstalled and restarted and installed my PC multiple times and it still won't play.
When clicking add a reference I can see the MVC.dll version 2.0.0.0 and add that no problem, but cannot manually upgrade the project since the ProjectTypeGuid used is not recognized.
For reference I am using Visual Web Developer 2008 on Windows XP. ASP.NET MVC version 1.0 is working fine and without issue.
Hope someone else can help.
DNH
I've installed MVC2 (VWD Express) on 3 computers now and 2 of them (Windows 7 and XP) have done this. I fixed both of them by uninstalling MVC1, MVC2 and VWD, then reinstalling via the Web Platform Installer. MVC1 is gone from WPI by the way. You can still download it from MS though. Could be just luck, but like I said, this worked twice for me.