Monday 21 April 2014

How to deploy a .Net User Control, that uses multiple assemblies, in a SYSPRO custom pane

If you create a simple .Net User Control and deploy it in a custom pane in SYSPRO, it will work, but if your user control accesses any non-system assemblies, your user control will appear as just a blank grey pane like this:

There are a number of ways you can resolve this:
  • Install your additional assemblies in the GAC.
  • Copy your additional assemblies to your SYSPRO/BASE folder (but leave your initial assembly in the SYSPRO/BASE/ManagedAssemblies folder). See see this post in the SYSPRO Forum for more details.
  • Write your own AssemblyResolve event handler. See see this same post in the Syspro Forum for more details.
  • Combine your assemblies into one assembly using ILMERGE, which you can download from Microsoft here.
    You can edit your .Net project’s properties and create a Post-Build event such as this:
"C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe" /v4 $(TargetFileName) YourDLL.dll YourSecondDLL.dll /out:"$(ProjectDir)$(OutDir)..\$(TargetFileName)"
If you need to copy the config file, you can add this to the Post-build event script:
copy $(TargetFileName).config "$(ProjectDir)$(OutDir)..\"
The double quotes are needed around the output directory if your output directory path has spaces in it.

No comments:

Post a Comment