Acumatica Publishing with DLL resulting in System.BadImageFormatException - acumatica

I am trying to add some external DLLs to the Acumatica Customisation project but upon publishing it results in "System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid."
Error Image:
I already have added multiple DLLs to the Customisation. And was using the method specified here: Acumatica unable to publish the Customization Package to skip over the errors, but in this case it does not seem to be working.

The first step should be identifying which DLL is the culprit. I suggest you create an empty project and put the files in there one by one with the ignore rules. Maybe you missed to add ignore rule for one of the files.
This error happens because Acumatica attempts to parse the DLL as a .Net framework assembly. If you add non .Net assembly such as native x86/x64 compiled libraries you need to add the ignore rule so Acumatica doesn't attempt to parse it.
If the error is coming from a DLL you compiled, make sure it was compiled in Any CPU platform. This prevents any incompatibility related to 32 bit/64 bit mismatch.

Related

Calling C DLL's compiled with SAFESEH set to no from Inno Script

I have an existing DLL that is working fine when being called from Inno Script however I need to add a function that calls another third party library (of which I do not have the source code).
Whenever I do that I get a 'could not call proc' error.
In order to compile (in Visual Studio) my DLL with the added function, I have to set SAFESEH to no because of the third party library. Is this likely to be what stops Inno Script from working? Are there any options available to resolve this?
Thanks in advance
Turning off SafeSEH is unlikely to prevent anyone from calling your function.
It is more likely that the 3rd-party library added a dependency to some DLL (MSVC run-time etc.). Use Dependency Walker to check if your imported DLLs change after you add the 3rd-party library.

different between ServiceStack.Interfaces.dll and ServiceStack.ServiceInterface.dll

Recently I am working on servicestack project. When I am trying to add open ServiceStack.ServiceInterface in project it is showing below error.
PFB image for code.
As suggested in error, when i am trying add open ServiceStack.Interfaces then it is showing dll is not present.
please tell me why it is showing error?
What is different of this two DLL?
ServiceStack.ServiceInterfaces contains interfaces used by the ServiceStack webstack while ServiceStack.Interfaces is used by the various other ServiceStack projects (like OrmLite) as well.
ServiceStack.ServiceInterfaces depends on ServiceStack.Interfaces, which means you have to install it as well (it is a seperate nuget package)

Orchard module doesn't work when built with VS2012

I've made a hello world module for orchard following this tutorial http://docs.orchardproject.net/Documentation/Building-a-hello-world-module
I've opened up the csproj in VS2012 and changed the projecttype guids to be MVC https://stackoverflow.com/a/12811015/828859
When I build the module in MVC orchard uses the published DLL.
When i attempt to go to the /helloworld route i get 404 resource cannot be found
When i save a file and let the dynamic compilation in orchard do it's thing it works fine.
I would like to be able to deploy with a DLL so does anyone have any ideas on the problem?
Ok, two things.
First - you won't be able to deploy your module as a single DLL. There are lots of things that do not get compiled into the DLL, eg. the Module.txt manifest. It has to be there under /Modules/<YourModuleName> (as well as module's .csproj file, .cshtml files and some more). Otherwise, Orchard won't be able to find your module.
So the source code for the module has to be there, although if you build it and the module's DLL is in /Modules/<YourModuleName>/bin folder, dynamic compilation won't kick in.
Second - module development should be done using full source code - not with the downloaded deployment package. Please read here how to get full source code.

Plugin registration tool throwing Unable to load plug-in assembly

I'm using the latest version of the MS CRM 2011 SDK and am trying to deploy a custom workflow activity (it has been signed with a key). The plugin registration tool throws an error "Unable to load plug-in assembly" without much information about the root cause.
The error trace thrown by the tool is very similar to the one described in this post
The answer to the post referenced above indicates adding Microsoft.Xrm.Client assembly in the GAC, but my workflow project references the following DLLs
1)Microsoft.Crm.Sdk.Proxy.dll
2)Microsoft.Xrm.Sdk.dll
3)Microsoft.Xrm.Client.dll
4)Microsoft.Xrm.Sdk.Workflow.dll
Should all these be added to the GAC?
The CRM server is Win 2K8R2. I tried dragging and dropping the assemblies to the c:\windows\assembly folder but that did not work. No errors but nothing was copied over either. I followed the instructions outlined in this post but that did not work either.
What am I missing?
I don't think you should have to place any crm dlls into the gac, they are already installed in the CRM server files. If you think it might solve the problem use gacutil (not clear if you can't install to the gac, or if that didn't fix the problem).
I suspect its complaining about your dll, are you trying to register to the disk? As you usually have to place the dll in the crm/server/bin folder first. Try deploying to the database - makes life easier for deploying the solution to other servers later.
If that still doesn't work post the trace of the error.
Turn on crm server side.tracing. You'll get much better error information. Use the CRM diagnostic tool to turn on trace logging: http://crmdiagtool2011.codeplex.com
Turns out that if you use the /codecustomization switch to have the code generator derive from "CrmOrganizationcContext", you need "microsoft.xrm.client.dll". This DLL is not included in the default install of CRM and you need to get this on the server one wa or another.
I decided against using the /codecustomization switch which causes the "context" to derive from "OrganizationContext" instead and not take a dependency on that DLL. Plugin registration now works! This post provides more insight

Error serializing with ServiceStack JSON on MonoTouch

I am experimenting with ServiceStack's JSON engine. I grabbed the MonoTouch binary build, v2.20. Works fine from simulator, but from the iOS device (iPad2, iOS5) I get an exception thrown by the type initializer for JsonWriter (and not much other than that). I am using MonoTouch 5, MonoDevelop 2.8.1, and targeting iOS 5. I have disabled library linking because I am getting an error when enabled.
I created a sample and uploaded to https://github.com/t9mike/ServiceStack-JSON1.
I'm trying to determine whether the issue is my compilation options, Service Stack, or MonoTouch. Thanks in advance.
A quick partial answer that might help:
I have disabled library linking because I am getting an error when enabled.
The current (5.0) managed linker can eliminate some unused (from a static analysis point of view) code from your application. This generally occurs when using Link all option, i.e. where user code gets processed by the linker.
One alternative is using the Link SDK assemblies only that won't touch the user code (only the code shipped with MonoTouch itself will be processed by the linker).
Another alternative is adding [Preserve] attributes on your code to ensure the serializer requirements are still met after the linker has processed your code. More information about the linker and [Preserve] attributes can be found here.
The next (5.2) release of MonoTouch will include a bit more sophisticated step in the linker to ensure the basic XML serialization and DataContract requirements are not broken. Not sure if this will solve this specific case (ServiceStack JSON) but I'll have a look into it.
As for the rest of your question I'll try to build this myself and duplicate your issue.
I ended up grabbing the ServiceStack.Text sources from GitHub, version 3.0.3. I created a new MonoTouch library project. I had to tweak ServiceStack.Text/JsConfig.cs slightly to conditionalize away the System.Drawing.Color bits. I'll send a patch and MT csproj to the authors.
After using this new assembly, my sample MT app ran fine on the device. I have updated my sample at https://github.com/t9mike/ServiceStack-JSON1 with the new ServiceStack.Text dll.

Resources