Assembly version error importing Dynamics 365 solution

Applies to: Dynamics 365

Symptom


When you attempt to import a solution in Dynamics 365 (online), the import fails with the following message

"The import of solution: [solution name] failed"

If you click Download Log File, you see details similar to the following message:

"An error occurred while importing a Solution. : Microsoft.Crm.CrmException: This plugin assembly uses version {0} of the .NET Framework. At this time Microsoft Dynamics 365 requires version {1} of the .NET Framework for plugin assemblies. Rebuild this assembly using .NET Framework version {1} and try again.    at Microsoft.Crm.ObjectModel.TargetFrameworkVersionValidator.ValidateInternal()    at Microsoft.Crm.ObjectModel.PluginValidatorBase.Validate()    at Microsoft.Crm.ObjectModel.PluginAssemblyServiceInternal`1.ValidateAssemblyMetadata(ExecutionContext context, IBusinessEntity pluginAssembly, CrmPluginAssemblyMetadata assemblyMetadata)    at Microsoft.Crm.ObjectModel.PluginAssemblyServiceInternal`1.VerifyRegistrationAbility(IBusinessEntity pluginAssembly, Boolean createCall, ExecutionContext context, CrmPluginAssemblyMetadata assemblyMetadata)    at Microsoft.Crm.ObjectModel.PluginAssemblyServiceInternal`1.ValidateOperation(String operationName, IBusinessEntity entity, ExecutionContext context)    at Microsoft.Crm.ObjectModel.SdkEntityServiceBase.CreateInternal(IBusinessEntity entity, ExecutionContext context, Boolean verifyAction)    at Microsoft.Crm.Tools.ImportExportPublish.ImportPluginAssemblyHandler.CreateOrGetExistingPluginAssembly(PluginAssembly pluginAssembly, String fileContent, BusinessProcessObject bpoService, Boolean skipValidation, BusinessEntityCollection& existingPluginAssemblies)    at Microsoft.Crm.Tools.ImportExportPublish.ImportPluginAssemblyHandler.ImportItem()"

In the example provided above, {0} is a version that is too high and {1} is the currently supported version. You may also see a reference to error code 8004420B, 8004418B, or -2147204725.

Cause


This error can occur if you are trying to import a solution that includes a plugin assembly compiled on a version of the .NET Framework that is not currently supported by Microsoft Dynamics 365 (online). 

Resolution


Recompile the assembly using the mentioned version of the .Net Framework.

For information about the .NET Framework version currently supported by Dynamics 365 (online), see Support for .NET Framework Versions.