AxUtilLib.dll Issue with .NET 4
Filed under: #daxmusings #bizapps
I ran into the following issue, which is now reported and recognized as an official bug by Microsoft.
When you use the AxUtilLib.dll assembly from a .NET 4 project, you can manage models from code. However, the DLL file is built against .NET 2.0 runtime. This poses no problem as those assemblies can be run in the .NET 4.0 runtime. However, when you export a model using this library in a 4.0 runtime, the exported model will be a.NET 4.0 assembly instead of a 2.0 assembly. When you then try to import this model using the powershell cmdlets or the axutil command line utility, you receive the following error message:
ERROR: The model file [filename] has an invalid format.
When you try to view the manifest of the model file, you get the following error message:
ERROR: Exception has been thrown by the target of an invocation.
When you open the axmodel file using ILSpy (remember the axmodel files are actual assemblies), you will notice that the model is a .NET 4.0 assembly, whereas a “good” model is .NET 2.0:
You will see the same behavior if you use the 2012 PowerShell cmdlets from PowerShell 3.0 (currently in beta). There is currently no fix for this, the only workaround is to use the command line utilities. Note that all other features work perfectly, including importing the model.
There is no comment section here, but I would love to hear your thoughts! Get in touch!