  | | | dotNet (was: IDE) | dotNet (was: IDE) 2005-04-06 - By kim aldis
Back yeah, the codebase thing threw up all sorts of warnings but basically it worked and I got to see the message from callMe() in XSI. I'm spanky new to C# but I'm looking at it because C++ has just too much crap surrounding it for someone who only needs to fall back on it once a month or so. If you figure out the correct way I'd like to hear. One question; how would one register this on a machine that doesn't have c# installed?
__ __
From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of Brad Friedman Sent: 05 April 2005 23:28 To: XSI@(protected) Subject: dotNet (was: IDE)
nice. Thats pretty much what I was going to do. The only thing that seems a tad off is the line:
regasm AxComp.dll /tlb:AxCompNet.dll /codebase
the filename specified after the ./tlb: should end with the extension .tlb, not dll. You can roll a .tlb into a dll as a resource with another command line app (forgot what its called). But its not neccesary. And apparently the .tlb file is not all that important to registering the typelib because... it works even though its got the wrong extension :)
The only other thing that needs ironing out is the nonsense with the /codebase flag. the docs from MS read:
Creates a Codebase entry in the registry. The Codebase entry specifies the file path for an assembly that is not installed in the global assembly cache. You should not specify this option if you will subsequently install the assembly that you are registering into the global assembly cache. The assemblyFile argument that you specify with the /codebase option must be a strong-named assembly.
its not all that difficult to either install the assembly into the GAC and skip the /codebase flag, or make the assembly strongly named. So I doubt that will cause much of an issue down the line once you get to installation issues.
I'm going to try giving this stuff a run in the next few days. If I get a LogMessage("HelloXSIWorld") functioning from c# I'm sure you'll hear from me :)
-brad
kim aldis wrote:
I tried this quickly and it works http://www.devhood.com/messages/message_view-2 (See http://iew-2.ora-code.com).aspx?thread_id=16569 but like you say, it seems kind of a specialised registration. That said, it's way shorter than the messing around you need to do with C++; even if there's a bit of a performance hit it's worth it just for how easy it is. I also kind of like the idea I can just create a single file and compile from the CL. Nice and simple. When I get time I'll be looking at it a bit closer.
__ __
From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of Brad Friedman Sent: 05 April 2005 18:13 To: XSI@(protected) Subject: Re: IDE
Thats the tricky and confusing part. I'm going to try using the regasm tool to register an assembly as a com type library next and see if that will work. But my understanding is that the .net assembly will need to be registered in the Global Assembly Cache (GAC) in order for it to work. And it will need a strong name. I suspect this will work. The downside is that I doubt this will work with an xsi .addon install. you'll need to install the .net assembly separate. Second, it wont really work the same way XSI's execution environment is set up. XSI likes to swap out com binaries via environment variables to make it possible to run multiple versions of XSI side by side. It also lets you put dlls in a workgroup and it handles registering them with com seamlessly. But the way .net wants to do its com serving, it needs to be global. You can't register .net assemblies with com using the usual registration tools (the way XSI does it when you install an addon). You have to use the regasm tool. I assume XSI doesn't do that itself. Though perhaps it should in the next version (nudge nudge wink wink).
I think its possible to make it work and I'll try and force it over the next week or so. I just don't think it will be as nice and cushy as a native com solution that XSI is built to handle seamlessly. But I could be wrong :)
And second (though maybe this is a given) none of this will work on linux as things currently sit. Neither Mono nor Portable.net implement any kind of COM interop. They do have PInvoke however, which is why wrapping the c++ api with SWIG was particularly interesting.
The atempt at using a hosted usercontrol was analagus to a ActiveX control... kinda. Its really hard to tell what is going on under the hood. Even microsoft documentation suggests that hosting a .net usercontrol via an OBJECT tag is infact ActiveX. Other times it seems they're just saying its "like" ActiveX to the point that you code it the same. But the whole thing is temporarily moot as a proper activex control is contained in a single .dll. A .net usercontrol that is using com interop to talk to the XSI type library is two dlls. So it wont work. I thought about ripping the .cs file that the tlbimp tool generates and handhacking it into the assembly namespace so its all self contained in one dll. I have just not tried it yet.
This is all kinda in progress :) Its nice to be a student on sabbatical. You get to spin your wheels on crazy R&D projects for the sake of it.
-brad
kim aldis wrote:
What about just creating ActiveX controls?
__ __
From: owner-xsi@(protected) [mailto:owner-xsi@(protected)] On Behalf Of Brad Friedman Sent: 05 April 2005 12:51 To: XSI@(protected) Subject: Re: IDE
As far as XSI integration goes:
have not had much luck. clr languages on windows can import COM type libraries and program to them. That part works fine. But I've been unable to finish off the loop as it were... getting XSI to call into a .net assembly in any way. My latest attempt involved creating user controls to embed in netview pages (like java applets or activex controls) but unfortunately it turns out there are complications with multiple DLLs and IE that makes it unreasonable.
I've also tried getting SWIG to wrap the XSI C++ interface in C#. It was able to wrap a few header files but the majority spat out errors and I decided I'm not programmer enough to fix them.
I've not given up yet. I still have a few tricks to try out.
If I ever got XSI to work with c# I'd be the happiest little coder...
-[kim aldis]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE></TITLE> <META http-equiv=Content-Type content="text/html; charset=us-ascii"> <META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD> <BODY text=#000000 bgColor=#ffffff> <DIV dir=ltr align=left><SPAN class=609022707-06042005><FONT face=Arial color=#0000ff size=2>yeah, the codebase thing threw up all sorts of warnings but basically it worked and I got to see the message from callMe() in XSI. I'm spanky new to C# but I'm looking at it because C++ has just too much crap surrounding it for someone who only needs to fall back on it once a month or so . If you figure out the correct way I'd like to hear.</FONT></SPAN></DIV> <DIV dir=ltr align=left><SPAN class=609022707-06042005><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV> <DIV dir=ltr align=left><SPAN class=609022707-06042005><FONT face=Arial color=#0000ff size=2>One question; how would one register this on a machine that doesn't have c# installed?</FONT></SPAN></DIV> <DIV dir=ltr align=left><SPAN class=609022707-06042005><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV> <DIV dir=ltr align=left><SPAN class=609022707-06042005></SPAN> </DIV><BR> <BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left> <HR tabIndex=-1> <FONT face=Tahoma size=2><B>From:</B> owner-xsi@(protected) [mailto:owner-xsi@(protected)] <B>On Behalf Of </B>Brad Friedman<BR><B>Sent:</B> 05 April 2005 23:28<BR><B>To:</B> XSI@(protected)<BR><B>Subject:</B> dotNet (was: IDE)<BR></FONT><BR></DIV> <DIV></DIV>nice. Thats pretty much what I was going to do. The only thing that seems a tad off is the line:<BR><BR><SPAN class=MsgViewAlternateBody>regasm AxComp.dll /tlb:AxCompNet.dll /codebase<BR><BR>the filename specified after the ./tlb: should end with the extension .tlb, not dll. You can roll a .tlb into a dll as a resource with another command line app (forgot what its called). But its not neccesary. And apparently the .tlb file is not all that important to registering the typelib because... it works even though its got the wrong extension :)<BR><BR>The only other thing that needs ironing out is the nonsense with the /codebase flag. the docs from MS read:<BR><BR>Creates a Codebase entry in the registry. The Codebase entry specifies the file path for an assembly that is not installed in the global assembly cache. You should not specify this option if you will subsequently install the assembly that you are registering into the global assembly cache. The assemblyFile argument that you specify with the /codebase option must be a strong-named assembly.<BR><BR>its not all that difficult to either install the assembly into the GAC and skip the /codebase flag, or make the assembly strongly named. So I doubt that will cause much of an issue down the line once you get to installation issues.<BR><BR>I'm going to try giving this stuff a run in the next few days. If I get a LogMessage("HelloXSIWorld") functioning from c# I'm sure you'll hear from me :)<BR><BR>-brad<BR><BR><BR></SPAN><BR>kim aldis wrote: <BLOCKQUOTE cite=mid200504051723.j35HNSPm011017@(protected) type="cite"> <META content="MSHTML 6.00.2800.1106" name=GENERATOR> <DIV dir=ltr align=left><SPAN class=390373417-05042005><FONT face=Arial color=#0000ff size=2>I tried this quickly and it works</FONT></SPAN></DIV> <DIV dir=ltr align=left><SPAN class=390373417-05042005></SPAN> </DIV> <DIV dir=ltr align=left><SPAN class=390373417-05042005><FONT face=Arial color=#0000ff size=2><A href="http://www.devhood.com/messages/message_view-2 (See http://iew-2.ora-code.com).aspx?thread_id=16569" >http://www.devhood.com/messages/message_view-2 (See http://iew-2.ora-code.com).aspx?thread_id=16569</A></FONT>< /SPAN></DIV> <DIV dir=ltr align=left><SPAN class=390373417-05042005></SPAN> </DIV> <DIV dir=ltr align=left><SPAN class=390373417-05042005><FONT face=Arial color=#0000ff size=2>but like you say, it seems kind of a specialised registration. That said, it's way shorter than the messing around you need to do with C++; even if there's a bit of a performance hit it's worth it just for how easy it is. I also kind of like the idea I can just create a single file and compile from the CL. Nice and simple. When I get time I'll be looking at it a bit closer.</FONT></SPAN></DIV><BR> <BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,255) 2px solid; MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left> <HR tabIndex=-1> <FONT face=Tahoma size=2><B>From:</B> <A class=moz-txt-link-abbreviated href="mailto:owner-xsi@(protected)">owner-xsi@(protected)</A> [<A class=moz-txt-link-freetext href="mailto:owner-xsi@(protected)">mailto:owner-xsi@(protected)</A>] <B>On Behalf Of </B>Brad Friedman<BR><B>Sent:</B> 05 April 2005 18:13<BR><B>To:</B> <A class=moz-txt-link-abbreviated href="mailto:XSI@(protected)">XSI@(protected)</A><BR><B>Subject:</B> Re: IDE<BR></FONT><BR></DIV>Thats the tricky and confusing part. I 'm going to try using the regasm tool to register an assembly as a com type library next and see if that will work. But my understanding is that the .net assembly will need to be registered in the Global Assembly Cache (GAC) in order for it to work. And it will need a strong name.  ; I suspect this will work. The downside is that I doubt this will work with an xsi .addon install. you'll need to install the .net assembly separate. Second, it wont really work the same way XSI's execution environment is set up. XSI likes to swap out com binaries via environment variables to make it possible to run multiple versions of XSI side by side. It also lets you put dlls in a workgroup and it handles registering them with com seamlessly. But the way .net wants to do its com serving, it needs to be global. You can't register .net assemblies with com using the usual registration tools (the way XSI does it when you install an addon). You have to use the regasm tool. I assume XSI doesn't do that itself. Though perhaps it should in the next version (nudge nudge wink wink).<BR><BR>I think its possible to make it work and I'll try and force it over the next week or so. I just don't think it will be as nice and cushy as a native com solution that XSI is built to handle seamlessly. But I could be wrong :)<BR><BR>And second (though maybe this is a given) none of this will work on linux as things currently sit. Neither Mono nor Portable.net implement any kind of COM interop. They do have PInvoke however, which is why wrapping the c++ api with SWIG was particularly interesting.<BR><BR>The atempt at using a hosted usercontrol was analagus to a ActiveX control... kinda. Its really hard to tell what is going on under the hood. Even microsoft documentation suggests that hosting a .net usercontrol via an OBJECT tag is infact ActiveX. Other times it seems they're just saying its "like" ActiveX to the point that you code it the same. But the whole thing is temporarily moot as a proper activex control is contained in a single .dll. A .net usercontrol that is using com interop to talk to the XSI type library is two dlls. So it wont work. I thought about ripping the .cs file that the tlbimp tool generates and handhacking it into the assembly namespace so its all self contained in one dll. I have just not tried it yet.<BR><BR>This is all kinda in progress :) Its nice to be a student on sabbatical. You get to spin your wheels on crazy R&D projects for the sake of it.<BR><BR>-brad<BR><BR>kim aldis wrote: <BLOCKQUOTE cite=mid200504051611.j35GB7Pm002759@(protected) type="cite"> <META content="MSHTML 6.00.2800.1106" name=GENERATOR> <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN class=062092416-05042005>What about just creating ActiveX controls?</SPAN></FONT></DIV><BR> <BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,255) 2px solid; MARGIN-RIGHT: 0px"> <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left> <HR tabIndex=-1> <FONT face=Tahoma size=2><B>From:</B> <A class=moz-txt-link-abbreviated href="mailto:owner-xsi@(protected)">owner-xsi@(protected)</A> [<A class=moz-txt-link-freetext href="mailto:owner-xsi@(protected)">mailto:owner-xsi@(protected)< /A>] <B>On Behalf Of </B>Brad Friedman<BR><B>Sent:</B> 05 April 2005 12:51<BR><B>To:</B> <A class=moz-txt-link-abbreviated href="mailto:XSI@(protected)">XSI@(protected)</A><BR><B>Subject:< /B> Re: IDE<BR></FONT><BR></DIV>As far as XSI integration goes:<BR><BR>have not had much luck. clr languages on windows can import COM type libraries and program to them. That part works fine. But I've been unable to finish off the loop as it were... getting XSI to call into a .net assembly in any way. My latest attempt involved creating user controls to embed in netview pages (like java applets or activex controls) but unfortunately it turns out there are complications with multiple DLLs and IE that makes it unreasonable.<BR><BR>I've also tried getting SWIG to wrap the XSI C++ interface in C#. It was able to wrap a few header files but the majority spat out errors and I decided I'm not programmer enough to fix them.<BR><BR>I've not given up yet. I still have a few tricks to try out.<BR><BR>If I ever got XSI to work with c# I'd be the happiest little coder...<BR><BR>-<SPAN class=062092416-05042005><FONT face=Arial color=#0000ff size=2>[kim aldis] </FONT></SPAN></BLOCKQUOTE></BLOCKQUOTE><BR>< /BLOCKQUOTE></BLOCKQUOTE><BR></BLOCKQUOTE></BODY></HTML>
|
|
 |