Thanks for the reply Jason.


2. Based on reports from you and Amy on this list, it would seem the bug is
not entirely fixed. I'll have to investigate further. Are there certain API
calls that often cause the CA to die? (Setting properties?)

>>> Well, what I'm really doing is getting / setting some properties from/to
>>> the session. Logging messages to the session. And that's about it. Not
>>> much else to do with the DTF API itself - but I was encrypting stuff
>>> (properties) that I read from the session, showing a form to select x509
>>> certs etc.

>> My CA method has a try/catch that surrounds all the code, to catch any
>> exception, log it to the session and return ActionResult.Failure.

Note that is not necessary because the code that calls the CA method does
exactly that already.
>>> Nice. I can get rid of that code then.

3. Good suggestion, I'll consider automatically including the PDB in the
package for Debug builds. Meanwhile you can accomplish this by editing the
project file: set a CustomActionContents property to a semicolon-delimited
list of additional files to be included.

>>> I looked at the MSBuild file and realised I could tweak that to add my
>>> pdb file. But wasnt too sure -- I'm not a MSBuild expert. :)

4. Any referenced assembly that's in the GAC (and CopyLocal=false) should
get loaded automatically by the CLR during the MakeSfxCA step and omitted
from the package. That is what I have observed to happen so far, but maybe
there is need for further investigation.

>>> Hmm...I'm not sure the MakeSfxCa class looks at whether an assembly is
>>> loaded from the GAC. I looked at the code and saw this:

(v.3.0.4207, DTF) - MakeSfxCA hooks up the ReflectionOnlyAssemblyResolve
event, and tries to load all dependent assemblies from the directory where
the managed CA dll compiles to.
In the delegate that you provide, you look in that directory (where the CA
dll was compiled) and try to find the libraries using
ReflectionOnlyLoadFrom.

>From what I know of reflection and from the stuff mentioned here:
http://blogs.msdn.com/junfeng/archive/2004/08/24/219691.aspx, I think the
missing link may be just to add a simple fallback to
'Assembly.ReflectionOnlyLoad', so that the GAC-ed assemblies will be
successfully loaded. Otherwise, as it happened in my case, it will fail for
things like System.Windows.Forms, and give an error message like:
---
System.IO.FileLoadException: Cannot resolve dependency to assembly
'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' because it has not been preloaded. When
using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or
loaded on demand through the ReflectionOnlyAssemblyResolve event.
---

I've tried to modify the MakeSFXCA.exe source and replace my installed
version of MakeSFX with the newly compiled one - but it didn't really work -
possibly because I compiled MakeSFX using my VS 2008 : instead of using the
make.bat and all that (since I really didnt want to compile the rest of the
wix stuff). Do you sign MakeSFXCA with a strong name or something? The error
I got when I used my version of MakeSFX was something like :
---
System.IO.FileLoadException: Could not load file or assembly
'Microsoft.Deployment.Resources, Version=0.0.0.0, Culture=neutral,
PublicKeyToken=null' or one of its dependencies. The located assembly's
manifest definition does not match the assembly reference. (Exception from
HRESULT: 0x80131040)
---

Anyway, I really only made a couple of changes:
1. To add a fallback if the assembly could not be resolved.
2. Check if the resolved assembly was loaded from the GAC - if so, 'donot'
add it to the input files list that will be packed.

Attached is my modified file. (You can look for comments starting with
//kna: to see where I changed things). I'm not sure if it will work or if it
is the best/preferred solution, but hopefully it will help.

http://www.nabble.com/file/p17754666/MakeSfxCA.cs MakeSfxCA.cs 

Till then though, unfortunately, I'll have to keep setting CopyLocal=True
for assemblies like System.Windows.Forms etc. :( And these files end up
being packed into my CA and my msi increasing its size (not really good -
but ok for now, while testing)!

Another small suggestion if I may:
In the installed version of Wix and DTF perhaps you guys should include the
PDB files as well? It may make it easier for people who think they've found
bugs in the toolset to verify against the source code.

Cheers
Krishna.
-- 
View this message in context: 
http://www.nabble.com/Problem-with-DTF-Custom-action-invoked-via-PushButton-Event-%3A-DoAction-tp17719937p17754666.html
Sent from the wix-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to