473,320 Members | 1,922 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

ReflectionOnlyLoad in Macro

Hi there,

I am trying to do a reflection only load of an assembly, within a new
appdomain, within a macro.

i.e.

create new app domain
instantiate class
run class
class does reflection only load of assembly
process info obtained from assembly
dispose of close
dispose of app domain

Unfortunately I am having difficulties instantiating an instance of the
class that does the reflection only load. The class is within "MyMacros".
So how would I load this class?

Dim pADnDomain As System.AppDomain =
System.AppDomain.CreateDomain("NewDomain")
Dim pOHeHandle As System.Runtime.Remoting.ObjectHandle =
pADnDomain.CreateInstance(<what assembly goes here?>,
"MyMacros.AssemblyBuildWorker")

I have no idea what assembly the class resides in, if it is within the
MyMacros namespace. Any ideas?

Nick.
Mar 1 '07 #1
3 1766
Hi there,

Well, I now believe the following *should* work, but I guess I just
can't do this sort of thing inside of a Macro...

Dim pADnDomain As System.AppDomain =
System.AppDomain.CreateDomain("Labia")
Dim pAWrTempWorker As New AssemblyWorker
Dim pOHeHandle As System.Runtime.Remoting.ObjectHandle =
pADnDomain.CreateInstance(pAWrTempWorker.GetType.A ssembly.GetName().FullName(),
"MyMacros.AssemblyBuildWorker")

I just get told it can't find the assembly, which is strange really, it
asks for the assemblies "display name" and the intellisense informs me that
the FullName property is also known as the "display name". Weird...

Nick.

"NickP" <a@a.comwrote in message
news:Oh**************@TK2MSFTNGP03.phx.gbl...
Hi there,

I am trying to do a reflection only load of an assembly, within a new
appdomain, within a macro.

i.e.

create new app domain
instantiate class
run class
class does reflection only load of assembly
process info obtained from assembly
dispose of close
dispose of app domain

Unfortunately I am having difficulties instantiating an instance of the
class that does the reflection only load. The class is within "MyMacros".
So how would I load this class?

Dim pADnDomain As System.AppDomain =
System.AppDomain.CreateDomain("NewDomain")
Dim pOHeHandle As System.Runtime.Remoting.ObjectHandle =
pADnDomain.CreateInstance(<what assembly goes here?>,
"MyMacros.AssemblyBuildWorker")

I have no idea what assembly the class resides in, if it is within the
MyMacros namespace. Any ideas?

Nick.

Mar 1 '07 #2
BTW, The reason I am trying to do this in the first place, is that I have a
macro that updates the version numbers in all projects in my solution (C++
and VB.NET projects).

In order to update the numbers I am acquiring the current version number of
the main assembly in the solution. Unfortunately VS.NET doesn't always
unload this assembly correctly and I am informed that the assembly cannot be
loaded twice in the same application domain, this error happens
intermittently. So I thought the best way to get around it would be to load
the application into a separate application domain, and bobs your uncle.

But in practice that is seeming to be a bit of a g1t.

Nick.

"NickP" <a@a.comwrote in message
news:OC*************@TK2MSFTNGP05.phx.gbl...
Hi there,

Well, I now believe the following *should* work, but I guess I just
can't do this sort of thing inside of a Macro...

Dim pADnDomain As System.AppDomain =
System.AppDomain.CreateDomain("Labia")
Dim pAWrTempWorker As New AssemblyWorker
Dim pOHeHandle As System.Runtime.Remoting.ObjectHandle =
pADnDomain.CreateInstance(pAWrTempWorker.GetType.A ssembly.GetName().FullName(),
"MyMacros.AssemblyBuildWorker")

I just get told it can't find the assembly, which is strange really, it
asks for the assemblies "display name" and the intellisense informs me
that the FullName property is also known as the "display name". Weird...

Nick.

"NickP" <a@a.comwrote in message
news:Oh**************@TK2MSFTNGP03.phx.gbl...
>Hi there,

I am trying to do a reflection only load of an assembly, within a new
appdomain, within a macro.

i.e.

create new app domain
instantiate class
run class
class does reflection only load of assembly
process info obtained from assembly
dispose of close
dispose of app domain

Unfortunately I am having difficulties instantiating an instance of
the class that does the reflection only load. The class is within
"MyMacros". So how would I load this class?

Dim pADnDomain As System.AppDomain =
System.AppDomain.CreateDomain("NewDomain")
Dim pOHeHandle As System.Runtime.Remoting.ObjectHandle =
pADnDomain.CreateInstance(<what assembly goes here?>,
"MyMacros.AssemblyBuildWorker")

I have no idea what assembly the class resides in, if it is within the
MyMacros namespace. Any ideas?

Nick.


Mar 1 '07 #3
Hmm very frustrating!

I had the idea of making a new macro helper class, and registering it with
the GAC. That way I could instantiate the class in another appDomain and
obtain the information that I require. Unfortunately the DLL will not show
up in the Macro add reference dialog, only a select number of assemblies are
visible!

Damn!

Can anyone recommend a good macro for customising version numbers in .NET
and C++ projects?

D

"NickP" <a@a.comwrote in message
news:eI**************@TK2MSFTNGP03.phx.gbl...
BTW, The reason I am trying to do this in the first place, is that I have
a macro that updates the version numbers in all projects in my solution
(C++ and VB.NET projects).

In order to update the numbers I am acquiring the current version number
of the main assembly in the solution. Unfortunately VS.NET doesn't always
unload this assembly correctly and I am informed that the assembly cannot
be loaded twice in the same application domain, this error happens
intermittently. So I thought the best way to get around it would be to
load the application into a separate application domain, and bobs your
uncle.

But in practice that is seeming to be a bit of a g1t.

Nick.

"NickP" <a@a.comwrote in message
news:OC*************@TK2MSFTNGP05.phx.gbl...
>Hi there,

Well, I now believe the following *should* work, but I guess I just
can't do this sort of thing inside of a Macro...

Dim pADnDomain As System.AppDomain =
System.AppDomain.CreateDomain("Labia")
Dim pAWrTempWorker As New AssemblyWorker
Dim pOHeHandle As System.Runtime.Remoting.ObjectHandle =
pADnDomain.CreateInstance(pAWrTempWorker.GetType. Assembly.GetName().FullName(),
"MyMacros.AssemblyBuildWorker")

I just get told it can't find the assembly, which is strange really,
it asks for the assemblies "display name" and the intellisense informs me
that the FullName property is also known as the "display name". Weird...

Nick.

"NickP" <a@a.comwrote in message
news:Oh**************@TK2MSFTNGP03.phx.gbl...
>>Hi there,

I am trying to do a reflection only load of an assembly, within a new
appdomain, within a macro.

i.e.

create new app domain
instantiate class
run class
class does reflection only load of assembly
process info obtained from assembly
dispose of close
dispose of app domain

Unfortunately I am having difficulties instantiating an instance of
the class that does the reflection only load. The class is within
"MyMacros". So how would I load this class?

Dim pADnDomain As System.AppDomain =
System.AppDomain.CreateDomain("NewDomain")
Dim pOHeHandle As System.Runtime.Remoting.ObjectHandle =
pADnDomain.CreateInstance(<what assembly goes here?>,
"MyMacros.AssemblyBuildWorker")

I have no idea what assembly the class resides in, if it is within
the MyMacros namespace. Any ideas?

Nick.



Mar 5 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

25
by: Andrew Dalke | last post by:
Here's a proposed Q&A for the FAQ based on a couple recent threads. Appropriate comments appreciated X.Y: Why doesn't Python have macros like in Lisp or Scheme? Before answering that, a...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
2
by: Pete | last post by:
In Access 95/97 I used to be able to create pull down menus (File,Edit ...) from a macro. It seems there used to be some wizard for that. However in Access 2000 it seems you have to build your...
7
by: Newbie_sw2003 | last post by:
Where should I use them? I am giving you my understandings. Please correct me if I am wrong: MACRO: e.g.:#define ref-name 99 The code is substituted by the MACRO ref-name. So no overhead....
3
by: Alexander Ulyanov | last post by:
Hi all. Is it possible to pass the whole blocks of code (possibly including " and ,) as macro parameters? I want to do something like: MACRO(FOO, "Foo", "return "Foobar";", "foo();...
8
by: lasek | last post by:
Hi...in some posts i've read...something about using macro rather then function...but difference ??. Best regards....
6
by: Takeadoe | last post by:
Dear NG, Can someone assist me with writing the little code that is needed to run an update table query each time the database is opened? From what I've been able to glean from this group, the...
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
0
by: =?Utf-8?B?TGV0emRvXzF0?= | last post by:
I'd like to create a Macro that will sort some raw data, apprx 20k lines, remove some lines based upon a condition in a certain column. Then copy this data into a new spreadsheet and sort the ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.