473,658 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ReflectionOnlyL oad 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.AppDomai n =
System.AppDomai n.CreateDomain( "NewDomain" )
Dim pOHeHandle As System.Runtime. Remoting.Object Handle =
pADnDomain.Crea teInstance(<wha t assembly goes here?>,
"MyMacros.Assem blyBuildWorker" )

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 1788
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.AppDomai n =
System.AppDomai n.CreateDomain( "Labia")
Dim pAWrTempWorker As New AssemblyWorker
Dim pOHeHandle As System.Runtime. Remoting.Object Handle =
pADnDomain.Crea teInstance(pAWr TempWorker.GetT ype.Assembly.Ge tName().FullNam e(),
"MyMacros.Assem blyBuildWorker" )

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******** ******@TK2MSFTN GP03.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.AppDomai n =
System.AppDomai n.CreateDomain( "NewDomain" )
Dim pOHeHandle As System.Runtime. Remoting.Object Handle =
pADnDomain.Crea teInstance(<wha t assembly goes here?>,
"MyMacros.Assem blyBuildWorker" )

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******** *****@TK2MSFTNG P05.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.AppDomai n =
System.AppDomai n.CreateDomain( "Labia")
Dim pAWrTempWorker As New AssemblyWorker
Dim pOHeHandle As System.Runtime. Remoting.Object Handle =
pADnDomain.Crea teInstance(pAWr TempWorker.GetT ype.Assembly.Ge tName().FullNam e(),
"MyMacros.Assem blyBuildWorker" )

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******** ******@TK2MSFTN GP03.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.AppDomai n =
System.AppDoma in.CreateDomain ("NewDomain" )
Dim pOHeHandle As System.Runtime. Remoting.Object Handle =
pADnDomain.Cre ateInstance(<wh at assembly goes here?>,
"MyMacros.Asse mblyBuildWorker ")

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******** ******@TK2MSFTN GP03.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******** *****@TK2MSFTNG P05.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.AppDomai n =
System.AppDoma in.CreateDomain ("Labia")
Dim pAWrTempWorker As New AssemblyWorker
Dim pOHeHandle As System.Runtime. Remoting.Object Handle =
pADnDomain.Cre ateInstance(pAW rTempWorker.Get Type.Assembly.G etName().FullNa me(),
"MyMacros.Asse mblyBuildWorker ")

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******* *******@TK2MSFT NGP03.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.AppDomai n =
System.AppDom ain.CreateDomai n("NewDomain" )
Dim pOHeHandle As System.Runtime. Remoting.Object Handle =
pADnDomain.Cr eateInstance(<w hat assembly goes here?>,
"MyMacros.Ass emblyBuildWorke r")

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
3234
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 clarification on what 'macro' means. A Lisp macro is a way of modifying code when that code is first defined. It can rearrange the structure of the code, and add and remove parts of it. Unlike C's #define macro language, Lisp macros understand the...
699
33867
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 capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
2
3482
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 menus by customizing a toolbar. With this method you have to create a separate macro for every single menu and sub menu. The old method would allow me to include several menus (File/ print/ page setup ...) all within one macro. Now it seems I...
7
23541
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. Execution is faster. Where will it be stotred?(Is it in bss/stack/?) FUNCTION:
3
8469
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(); bar();")
8
10862
by: lasek | last post by:
Hi...in some posts i've read...something about using macro rather then function...but difference ??. Best regards....
6
6430
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 Autoexec Macro looks like the way to go. Could someone please assist? Thank you very much! Mike
5
3481
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 the cursor was on in the datasheet at the time I executed the macro. So, the questions are: 1) In the macro, how to I get my hands on the record key or record data of the record the cursor was on in the datasheet at the time I executed the...
0
2049
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 data again and delete the unwanted data and repeat few more times in new sheets. End product will be apprximately 7 or 8 sheets - 1 for Active Customers, Inactive Customers, Pending Installs, Etc... I'm getting hung up I believe with naming...
0
8330
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.