all groups > dotnet setup > december 2003 >
You're in the

dotnet setup

group:

setup needs to copy file to folder given in registry



setup needs to copy file to folder given in registry konsu
12/26/2003 5:15:47 PM
dotnet setup: hello,

my project implements a browser helper object, which is compiled for .NET
1.1, but in order to run it under .NET 1.0, I need to properly redirect 1.1
assemblies to their 1.0 versions. and since a browser helper object is just
a dll, i need to create iexplore.exe.config to enable the redirection.

1. during setup, i need to look up the location of iexplore.exe in
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App
Paths\IEXPLORE.EXE", and copy the config file to this location.

2. i would prefer to do it only if the target machine has no .NET 1.1
installed.

what is the best way to do it?

thanks for any help
konstantin

Re: setup needs to copy file to folder given in registry Phil Wilson
12/30/2003 10:57:14 AM
I suspect that the best way to do this is with a publisher policy in the
GAC.
--
Phil Wilson
[MVP Windows Installer]
[quoted text, click to view]

Re: setup needs to copy file to folder given in registry konsu
12/31/2003 2:00:41 PM
how this can be achieved with a publisher policy? i am not trying to
redirect to a different version of my assembly, I am trying to tell .NET to
use different versions of system assemblies when loading my assembly. my
assembly is compiled for .net 1.1, so by default .NET will try to use the
system assemblies for .NET 1.1 instead of 1.0.


konstantin



[quoted text, click to view]

Re: setup needs to copy file to folder given in registry Phil Wilson
1/1/2004 12:50:57 PM
Sorry, you didn't mention system assemblies originally, so I got the
impression you were trying to redirect to your own assemblies.
In any case, it's not clear to me why you think you need that config file. A
BHO is a COM server, so it's registered using COM interop, and the registry
entries are this kind of thing (copied from MS docs).

HKEY_CLASSES_ROOT\CLSID\{clsid}\InProcServer32
(default) = %systemroot%\mscoree.dll
Assembly = assembly name and version information
Class = class name
ThreadingModel = Both
RuntimeVersion = version_of_the_runtime

In this situation, I don't see what an application config file for
iexplore.exe does that helps choose a framework version.
--
Phil Wilson
[MVP Windows Installer]
[quoted text, click to view]

Re: setup needs to copy file to folder given in registry konsu
1/2/2004 1:09:47 PM
Phil,
in iexplore.exe.config i have <startup> and <runtime> sections that redirect
..NET 1.1 system assemblies to their 1.0 versions (below). without that, my
BHO won't load because CLR won't be able to find the assemblies that my BHO
was compiled against (that is, version 1.1). Am I missing something obvious
like maybe changing the RuntimeVersion registry key that you listed below?

I register my BHO assembly using the Installer class:

public override void Install(IDictionary state)
{
base.Install(state);
RegistrationServices registration = new RegistrationServices();
if (!registration.RegisterAssembly(GetType().Assembly,
AssemblyRegistrationFlags.SetCodeBase))
{
throw new InstallException("Cannot register browser
plug-in");
}
}


thanks
konstantin

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<requiredRuntime imageVersion="v1.0.3705" version="v1.0.3705" />
<supportedRuntime version="v1.1.4322"/>
<supportedRuntime version="v1.0.3705"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"
appliesTo="v1.0.3705">
<dependentAssembly>
<assemblyIdentity name="Accessibility"
publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535"
newVersion="1.0.3300.0"/>
</dependentAssembly>
...
...
...
<dependentAssembly>
<assemblyIdentity name="System" publicKeyToken="b77a5c561934e089"
culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-65535.65535.65535.65535"
newVersion="1.0.3300.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>


[quoted text, click to view]

Re: setup needs to copy file to folder given in registry Phil Wilson
1/5/2004 10:58:12 AM
This is basically COM interop, and I do this kind of thing by simply installing
the class library with the Register property set to vsdraCOM. That extracts all
the right stuff into the MSI file, and then you just install the MSI file and
all the right entries are there. (Same as registering with regasm). I've not
specifically done this with a BHO, but that's the standard way to register a COM
interop DLL, and I'm wondering if you've tried that. You *can* have an
exe.config file for your clients, but it should just work without one. Do you
get a specific HRESULT or something when it fails? 1.0 assemblies typically run
on both 1.0 and 1.1 framework versions (and on Server 2003, 1.1 is installed by
default and requests for 1.0 get routed to 1.1 and it just works).
--
Phil Wilson [MVP Windows Installer]
----
[quoted text, click to view]

Re: setup needs to copy file to folder given in registry konsu
1/5/2004 2:20:00 PM
well, if using vsdraCOM is the same as registering with regasm then my
Installer code also must have the same result because using
RegistrationServices in Installer is the same as using regasm, right?

also, it seems that i was not clear. i am trying to run a 1.1 assembly on
1.0 CLR. that is the initial problem. i know that CLR 1.1 runs 1.0
assemblies without any special configuration but this does not apply to my
problem.

i do not get any visible error from IE, it just runs silently and does not
invoke my BHO's code when i click on the BHO's icon. if i put my
iexplore.exe.config file with all the bindings into iexplore.exe's folder
and reload IE it works...

so, to simplify, in my dev studio solution i have a project for my BHO,
which has its own Installer implementation and a couple of methods that are
marked as ComRegisterFunction and ComUnregisterFunction. and i have a setup
project to which i added the primary output from my BHO project. i also
added primary output from the BHO project to the list of custom actions so
that my registration methods are invoked during install. i did not change
any registration properties in the setup's properties window, so my BHO is
marked as vsdrpDoNotRegister. the "register for com interop" in BHO's build
properties is also set to false.

if i understand you correctly, instead of all that you suggest that i
generate a TLB from my BHO assembly and add it to the setup project and set
its Register property to vsdraCOM? how do i make setup invoke my BHO's
registration methods then?

by the way, do you know the purpose of the "register for com interop"
setting in a class library project's build properties dialog?

i am totally confused with all these different ways to register my stuff...



[quoted text, click to view]
for
Re: setup needs to copy file to folder given in registry Phil Wilson
1/6/2004 11:22:42 AM
Inline comments...

Plus, your original question was about finding IE, and one approach is to look
in the registry at HKCR\Applications\iexplore.exe\shell\open\command for the
default string, which is the path to iexplore.exe.

You could also look at the CLSID path for the IE COM class associated with the
ProgID "InternetExplorer.Application".

--
Phil Wilson [MVP Windows Installer]
----
[quoted text, click to view]

Maybe, it's just that I don't know what else regasm does. You'd have to compare
your RegisterAssembly result with what regasm does.

[quoted text, click to view]

If your assembly requires 1.1 CLR it would be better to install the 1.1 CLR. I
know it's not strictly a requirement if your 1.1 code is guaranteed to always
use 1.0 types, but you could guarantee that by using VS.NET, and then you
wouldn't be trying to do this redirection. I guess it just seems that you're
making things difficult for yourself: why not develop with the 1.0 framework and
VS.NET or get the 1.1 CLR installed?

[quoted text, click to view]

If you have a class library that offers COM interfaces, and in a VS setup and
deployment project you set the Register property to vsdraCOM, the MSI file gets
built with all the correct registry entries that will be applied to the system
when you install the MSI file. What happens at build time is that VS runs regasm
and extracts all the registration data into the MSI file. The end result is that
there's no need to run your registration code in custom actions. One of the main
points about the MSI stuff is that this data is in the MSI file and you don't
need to run registration code at install time. Your registration code really
runs ok even though it wants the 1.1 framework??

Register for COM interop runs regasm on the compiled code. Ultimately, it's
regasm everywhere: in the register for COM interop setting, in the MSI build
process. Regasm is, I suspect, a superset of RegisterAssembly, there's a lot
more code in it than just a call on RegisterAssembly.


[quoted text, click to view]
AddThis Social Bookmark Button