Hi,


I asked the same question a while ago. After some experiment, I repost this 
question with more information. It is very important for me because the C# 
custom action solution cannot scale without resolving signing issue. Without 
strong name signed, customaction.dll cannot consume other signed managed dlls.



This is my original question:



My msi uses custom action from C# custom action project.



As you know, as C# custom action project will generate mycustom.dll and 
mycustom.CA.dll. The former is managed and the later is unmanaged.



In my project, all binaries (including mycustom.dll and mycustom.CA.dll) are 
signed and the msi is not.



When I installed the msi, it threw below exception:



Error: could not load custom action class My.CustomActions from assembly: 
My.CustomAction

System.IO.FileLoadException: Could not load file or assembly 'My.CustomAction, 
Version=1.0.82.0, Culture=neutral, PublicKeyToken=31bb5956ad364e35' or one of 
its dependencies. Strong name validation failed. (Exception from HRESULT: 
0x8013141A) File name: 'My.CustomAction, Version=1.0.82.0, Culture=neutral, 
PublicKeyToken=31bb5956ad364e35' ---> System.Security.SecurityException: Strong 
name validation failed. (Exception from HRESULT: 0x8013141A) The Zone of the 
assembly that failed was:

MyComputer

   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, 
Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, 
Boolean throwOnFileNotFound, Boolean forIntrospection)

   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, 
Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence 
assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

   at System.AppDomain.Load(String assemblyString)

   at 
Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod(Session
 session, String assemblyName, String className, String methodName)





Currently, my solution is isolating C# custom action project from other managed 
projects so that it does not reference any other managed dlls. I did not sign 
custom action project (strong name sign for customaction.dll, authenticode sign 
for customaction.ca.dll).



However, I am more interested about change the build process so that managed 
assembly gets fully signed before being packed up in the .CA.dll.



We are using corext and msbuild to build the csproj and wixproj. The current 
build process is:



Step 1: build managed binaries as delay signed (include custom action project);



Step 2: in postbuild1, the managed binaries are signed (include 
customaction.dll);



Step 3: in postbuild2, the msi is generated;



To make managed assembly gets fully signed before being packed up in the 
.CA.dll, the build process should be changed to:



Step 1: build managed binaries as delay signed (include custom action project);



Step 2: in postbuild1, the managed binaries are signed (include 
customaction.dll);



Step 3: in postbuild2, customaction.ca.dll using the signed customaction.dll;



Step 4: still in postbuild2, the msi is generated.



However, I have trouble to separate building customaction.dll and 
customaction.ca.dll from the custom action csproj file. How can I author files 
like wix.ca.targets to let the build engine know to use the signed 
customaction.dll instead of regenerating a new one?



Does anyone have any experience on get customaction.dll strong name signed and 
work?



Appreciate your help.





Thanks

Lian

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to