Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / February 2005

Tip: Looking for answers? Try searching our database.

Installing a project/package

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Foust - 07 Feb 2005 19:08 GMT
I'm to the point where I'm trying to install my new package and project. I'm
running into some strange behavior and am hoping the community here can help
figure out whats wrong.

Several of our assemblies require regasm.exe to be run on them. We're using
the Visual Studio setup project to make the setup, but it does not seem to
support using regasm! As you know, you can specify the registration property
on a file, but they are all COM related. I cannot find any help to tell me
what the different registration types mean, but none of them say REGASM, so
I assume that its not there.

Now, we use a setup helper DLL to do the registration. We copy REGASM.EXE
into the setup, install it, use the DLL to run it and then delete it. I'd
like to not do this, but there appears to be no way to determine the PATH of
the .NET Framerwork directory, so we do it this way.

now the problem is that on the install machine, REGASM won't run out of our
product install directory. I can't figure out why, but it only seems to run
out of the .NET Framework directory. On my development machine, I've copied
regasm into another dir and it runs just fine, but it won't run on the
install machine. So here are my questions

Is there a Registration Type that will run REGASM on the assebly in the
setup properties? We need to use the /codebase option on one of the
assemblies.

Is there a way to determine the path of the .NET framework install directory
so that we can run REGASM from there?

Thanks
Bill
Carlos J. Quintero [.NET MVP] - 08 Feb 2005 11:23 GMT
Notice that the only purpose of regasm.exe is to register a .NET assembly as
a COM component. There are at least 3 ways to register a .NET assembly for
COM interop:

- Using regasm.exe. The information to guess the path of this file is in the
registry, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework, InstallRoot,
etc. Regasm.exe should be used only with manual installations, because it is
error-prone to locate its path and to get the result of the registration.

- Using System.Runtime.InteropServices.RegistrationServices.RegisterAssembly
function of the .NET Framework (mscorlib). This is used if you want to build
your own regasm.exe utility, for example, or if your startup .NET assembly
needs to register others for COM interop at run-time rather than at
setup-time.

- Using a VS.NET setup project, through the "Register" property of the
assembly (Properties window) which must be set to vsdrpCOM. This is the
recommended way for setups.

Signature

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com

> I'm to the point where I'm trying to install my new package and project.
> I'm
[quoted text clipped - 37 lines]
> Thanks
> Bill
Bill Foust - 16 Feb 2005 15:24 GMT
I just have to say that I am having such a tough time with this. I really
hope that Microsoft can make something that helps this process out. Even a
good knowledgebase article would be helpful.

I tried using the Register property of the Setup Project on my items that I
want to register. I could never get it to work for me. Using both vsdrpCOM
and vsdrpCOMSelfRegister (cause we have a managed C++ Dll that needs to be
registered with REGSVR32) did not seem to actually work correctly. I had
read a blog that said they do not work with PROJECT OUTPUT type of files,
but that you have to manually select the file from the Debug dir and add it
that way, but still didnt seem to work out.

I tried using RegisterAssembly call and I was never able to get the assembly
to load successfully to try to call this. All of the assemblies that need
registering rely on other assemblies and even though they are all installed
to the same directory, .NET is apparently unable to find them. Not to
mention our path has a COMMA in it, and no matter what I did the
Assembly.Load call wanted to convert that into an AssemblyPath and parse out
the comma.

I tried usiung Process.Start to spawn REGASM and VSIPREGPKG to do their
thing and ran into the same pathing problem. Neither of them would run
because they apparently could not find the dependent assemblies., I even
used the ProcessStartInfo class and set the WorkingDirectory, but that didnt
work either.

THE ONLY WAY ive found to get these things installed is to copy REGASM and
VSIPREGPKG to the install dir and then call a RUNME.BAT file and pass it the
directory so the BAT file can first CD into the dir and then run each of the
files. Apparently using the Setup project in MSVStudio likes to run in the
Windows/System32 directory andf I've not found a way to change that. I don't
like this solution though, becasue it doesn't work well if you install to a
different drive letter.

Suffice it to say that this has been a very annoyting process.

Comments and suggestions please!

Bill

> Notice that the only purpose of regasm.exe is to register a .NET assembly as
> a COM component. There are at least 3 ways to register a .NET assembly for
[quoted text clipped - 6 lines]
>
> - Using
System.Runtime.InteropServices.RegistrationServices.RegisterAssembly
> function of the .NET Framework (mscorlib). This is used if you want to build
> your own regasm.exe utility, for example, or if your startup .NET assembly
[quoted text clipped - 46 lines]
> > Thanks
> > Bill
Carlos J. Quintero [.NET MVP] - 16 Feb 2005 16:27 GMT
Since it seems that you have a lot of problems with the different approaches
that you are using, in my experience the way to solve this is to start with
the basics and then add steps to the final goal. So, forget for now your
project and let's return to the basics:

> I tried using the Register property of the Setup Project on my items that
> I
> want to register. I could never get it to work for me. Using both vsdrpCOM

- Create a new managed Class Library project in VS.NET with a single class,
create a setup project for it which registers it for COM and test it until
it works as expected.

> I tried using RegisterAssembly call and I was never able to get the
> assembly
> to load successfully to try to call this. All of the assemblies that need
> registering rely on other assemblies and even though they are all
> installed
> to the same directory, .NET is apparently unable to find them.

- Create a new managed Class Library project in VS.NET with a single class,
create a new Windows Form application which uses RegisterAssembly to
register it for COM and test it until it works as expected.

> and vsdrpCOMSelfRegister (cause we have a managed C++ Dll that needs to be
> registered with REGSVR32) did not seem to actually work correctly

- Create a new Win32 DLL project in VS.NET, create a setup project for it
which registers it for COM and test it.

> Not to mention our path has a COMMA in it, and no matter what I did the
> Assembly.Load call wanted to convert that into an AssemblyPath and parse
> out
> the comma.

- Create a new managed Class Library project in VS.NET, put it in a folder
with a comma, create a new Windows Form application which uses Assembly.Load
to load it.

I mean, your actual project may have a mess, but each one of these isolated
steps is quite simple and it should work. If not, you can post a very simple
step-by-step procedure for other person to reproduce and solve it.
Simplifying and understanding the basics you can combine later the pieces
for your actual situation.

Signature

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.