Skip to content

Instantly share code, notes, and snippets.

@abelevtsov
Last active September 9, 2019 10:48
Show Gist options
  • Save abelevtsov/5c2467a1be028f5f127d4ae6b9d0e965 to your computer and use it in GitHub Desktop.
Save abelevtsov/5c2467a1be028f5f127d4ae6b9d0e965 to your computer and use it in GitHub Desktop.
set MERGED_PATH=Merged
set SN_PATH=C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools
set DOTNET_PATH=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2
set PLUGIN_ASSEMBLY_NAME=YourNamespace.Plugins.dll
set MODULES_LIST=YourNamespace.Plugins.dll
set ADDITIONAL_LIBRARIES_LIST=YourNamespace.CrmProxyClasses.dll NLog.dll AutoMapper.dll Polly.dll
rd /s /q %MERGED_PATH%
md %MERGED_PATH%
del Polly.pdb
"%SN_PATH%\sn" -p keyfile.pfx keyfile.pub
ilmerge.exe /targetplatform:"v4,%DOTNET_PATH%" /lib:"%DOTNET_PATH%" /attr:%PLUGIN_ASSEMBLY_NAME% /closed /keyfile:keyfile.pub /delaysign /t:library /out:%MERGED_PATH%\%PLUGIN_ASSEMBLY_NAME% %MODULES_LIST% %ADDITIONAL_LIBRARIES_LIST%
"%SN_PATH%\sn" -R %MERGED_PATH%\%PLUGIN_ASSEMBLY_NAME% keyfile.pfx
pause
set SLN_CONFIG=Merged
set DOTNET_PATH=C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.2
set PluginAssemblyName=Past_Your_PluginAssembly_Name_Here
set MODULES_LIST=Past_Your_Modules_List_Here
set ADDITIONAL_LIBRARIES_LIST=Microsoft.Practices.EnterpriseLibrary.Common.dll Microsoft.Practices.EnterpriseLibrary.Data.dll Newtonsoft.Json.dll AutoMapper.dll Polly.dll
rd /s /q %SLN_CONFIG%
md %SLN_CONFIG%
del Polly.pdb
ilmerge.exe /targetplatform:"v4,%DOTNET_PATH%"" /lib:"%DOTNET_PATH%"" /attr:%PluginAssemblyName% /closed /keyfile:keyfile.snk /t:library /out:%SLN_CONFIG%/%PluginAssemblyName% %MODULES_LIST% %ADDITIONAL_LIBRARIES_LIST%
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment