<feed version="0.3" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://purl.org/atom/ns#" xml:lang="de-DE"><title>Cull'log</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/default.aspx" /><tagline type="text/html">Stefan Cullmann's Blogging</tagline><id>http://www.dotnetjunkies.com/WebLog/culllog/default.aspx</id><author><url>http://www.dotnetjunkies.com/WebLog/culllog/default.aspx</url></author><generator url="http://communityserver.org" version="1.0.1.50214">Community Server</generator><modified>2004-03-14T18:51:00Z</modified><entry><title>GotDotNet Workspaces</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/28/10211.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:10211</id><created>2004-03-28T19:53:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;I tried to add an existing project to a solution that is placed under the source control of GotDotNet Workspaces. This finally results in nearly destroying my solution file, I can't save it&amp;nbsp;under the original name. I am not&amp;nbsp;able to check in or out using the visual studio workspace plug in any more. Opening the solution file again doesn't work. No Fun. &lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=10211" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Adventures writing Visual Studio Add-Ins</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/28/10210.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:10210</id><created>2004-03-28T19:41:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;I thought it would be nice to integrate an ASP.NET like template language inside my Greenator-AddIn. Instead of reinventing the wheel, I decided to use the m3rlin.engine Assembly. &lt;A href="http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=dfef25fa-f545-4289-b9fc-05270ea41fb3"&gt;m3rlin &lt;/A&gt;is a XML-centric templating code generator by &lt;A href="http://dotnetjunkies.com/WebLog/josephcooney/"&gt;Joseph Cooney&lt;/A&gt;. It generates code by hosting the ASP.NET runtime. &lt;BR&gt;In my last post, I described an issue about creating an appdomain; which is needed to host the asp.net runtime. This problem was solved in signing the assembly and publishing the assembly in the GAC. &lt;BR&gt;Today I examined another really strange behaviour inside of Visual Studio Add-Ins. M3rlin.engine calls HttpRuntime.AspInstallDirectory(), and that call gets me a System.ArgumentNullExeption (Parameter name str). First I thought that I might not be allowed to call it inside of a com interop. I decided to examine this in a separate add in. I generated a new visual studio add in (&amp;#8220;AddInTest&amp;#8221;) and placed the following code inside the Connect class.:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;FONT size=2&gt; Exec(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;FONT size=2&gt; commandName, EnvDTE.vsCommandExecOption executeOption, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ref&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; varIn, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ref&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;object&lt;/FONT&gt;&lt;FONT size=2&gt; varOut, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;ref&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;bool&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; handled)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handled = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;false&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;(executeOption == EnvDTE.vsCommandExecOption.vsCommandExecOptionDoDefault)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;if&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;(commandName == "AddInTest.Connect.AddInTest")&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;string&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; x = System.Web.HttpRuntime.AspInstallDirectory;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show (x);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;catch&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; (SystemException ex)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show (ex.GetType().ToString()+": "+ ex.Message);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; handled = &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;true&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;I started the project and clicked the &amp;#8222;AddInTest&amp;#8220; button and was surprised to get the wanted result: &amp;#8220;C:\Windows\Microsoft.Net\Framework\v1.1.4322&amp;#8221;. Opening a solution and executing the button again is still ok.&lt;BR&gt;But starting VS-Studio, first opening a solution and then executing the button raises the System.ArgumentNullExeption. Even more confusing: it depends on the opened solution. Some of them will reproduce the error. others will give me the right result. I can't get why.&lt;/P&gt;
&lt;P&gt;M3rlin.engine needs the value of HttpRuntime.AspInstallDirectory to set the &amp;#8220;hostingInstallDir&amp;#8221; of the created appdomain and run the ASP.NET host. I moved the&amp;nbsp;function call inside of the new appdomain (&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;AppDomain.CurrentDomain.SetData(".hostingInstallDir", HttpRuntime.AspInstallDirectory)&lt;/FONT&gt;&lt;/FONT&gt;. Now every thing runs fine.&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=10210" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Working with AppDomains inside a VisualStudio Add-In</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/21/9641.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9641</id><created>2004-03-21T17:13:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;The VisualStudio Add-In "MyTestPlugIn" is installed by&amp;nbsp;default&amp;nbsp;at &lt;NOBR&gt;%Program Files%\MyTestPlugIn&lt;/NOBR&gt;. I have to create an AppDomain inside&amp;nbsp;the Add-In and to create an instance of a Worker Class. This will result in an InvalidCastException.&lt;/P&gt;
&lt;P&gt;This code is called from the exec command inside the connect class:&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;try&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AppDomainTest.Worker Worker = AppDomainTest.Factory.CreateWorker ();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Worker.DoIt();&lt;BR&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;catch&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; (SystemException ex)&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show (ex.GetType().ToString()+": "+ ex.Message);&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;/FONT&gt;The&amp;nbsp;appdomain factory and worker class look like this:&amp;nbsp;&lt;/P&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;using&lt;FONT color=#000000 size=2&gt; System;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT color=#000000&gt; System.Runtime.Remoting;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;using&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; System.Reflection;&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;namespace&lt;/FONT&gt;&lt;FONT color=#000000 size=2&gt; AppDomainTest&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;BR&gt;{&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; Worker:MarshalByRefObject&amp;nbsp;&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; Worker(){}&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;void&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; DoIt()&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;{&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;System.Windows.Forms.MessageBox.Show ("Hello World");&lt;BR&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;}&lt;BR&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;
&lt;P&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;class&lt;/FONT&gt;&lt;FONT size=2&gt; Factory&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;public&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;static&lt;/FONT&gt;&lt;FONT size=2&gt; Worker CreateWorker()&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assembly currentAssembly =Assembly.GetExecutingAssembly();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AppDomain ad = AppDomain.CreateDomain("WorkerTest");&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ObjectHandle oh = ad.CreateInstanceFrom&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (currentAssembly.Location, &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;typeof&lt;/FONT&gt;&lt;FONT size=2&gt;(Worker).FullName );&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;return&lt;/FONT&gt;&lt;FONT size=2&gt; (Worker) oh.Unwrap(); &lt;FONT color=#008000 size=2&gt;//InvalidCastException&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;
&lt;P&gt;Note:&lt;BR&gt;The call will work without raising an exception if called from a winform or console. It seems that the add-in assembly can not be found by visual studio to decide if it is the same assembly and type. As a matter of fact copying the add-in assembly inside the Visual Studio\common7\ide directory solves this problem.&lt;/P&gt;
&lt;P&gt;&lt;COPYING P &lt; raised. be will SystemCastException No problem. the resolves directory 2003\Common7\IDE? .NET Studio Visual files%\Microsoft ?%program to assembly add-in&gt;
&lt;P&gt;But I don't want to place my add-in dlls at two different locations and certainly not under the Visual Studio Path.&lt;/P&gt;
&lt;P&gt;Playing around with AppDomain.AppendPrivatePath, added an AppDomainSetup setting the ApplicationBase and PrivateBinPath but this problem remains unsolved.&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9641" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Greenator Documentation updated</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/20/9572.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9572</id><created>2004-03-20T09:52:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;Until&amp;nbsp;now I finished three articles:&lt;/P&gt;
&lt;LI&gt;&lt;A href="http://dotnetjunkies.com/WebLog/culllog/articles/9458.aspx"&gt;First steps using Greenator&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://dotnetjunkies.com/WebLog/culllog/articles/SimpleParser.aspx"&gt;"Simple" Template Language&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://dotnetjunkies.com/WebLog/culllog/articles/GRulez.aspx"&gt;Rules&lt;/A&gt;&lt;/LI&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9572" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Greenator V0.1 published</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/19/9462.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9462</id><created>2004-03-19T02:07:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;Greenator V0.1 published at &lt;A href="http://workspaces.gotdotnet.com/greenator"&gt;http://workspaces.gotdotnet.com/greenator&lt;/A&gt;! &lt;BR&gt;First steps in using Greenator are descriped in a&amp;nbsp; &lt;A href="http://dotnetjunkies.com/WebLog/culllog/articles/9458.aspx"&gt;article&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9462" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>HTML Generation vs. Code Generation </title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/17/9352.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9352</id><created>2004-03-17T19:50:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;Before talking about application code generation, let&amp;#8217;s have a closer look at the generator techniques we are all familiar with; let&amp;#8217;s examine html generators.&lt;/P&gt;
&lt;P&gt;In the old days, at the beginning of the internet time age, some geeks discovered very fast the power of generators. The first generators were written in C or Perl and got famous under the term CGI.&lt;/P&gt;
&lt;P&gt;Later some template language based generators like ASP and PHP appeared. A lot of people started to use them. The ice for html generation was broken.&lt;/P&gt;
&lt;P&gt;Later was recognized that it wasn&amp;#8217;t really a good idea to mix code and design at one place. That&amp;#8217;s one point what ASP.NET is about. Code and Design are now separated into two files. In addition an even higher abstraction level was introduced by using the OO features of the .NET Framework. We are now able to add objects like tables, rows and cells to controls without using a template. Due to this fact it is possible to create the output for different targets like Internet Browsers and mobile devices.&lt;/P&gt;
&lt;P&gt;Let&amp;#8217; summarize this in a fact sheet and compare it to active code generation:&lt;/P&gt;
&lt;TABLE style="BORDER-COLLAPSE: collapse" border=1&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;CGI&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;ASP/PHP&amp;#8230;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;ASP.NET/code behind&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;name proposal&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;script&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;template language&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;object model&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;Code looks like&lt;/P&gt;&lt;/TD&gt;
&lt;TD noWrap&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=1&gt;write &lt;FONT color=#800080&gt;&lt;FONT color=#000000&gt;(&lt;/FONT&gt;&lt;FONT color=#800080&gt;"&lt;/FONT&gt;&amp;lt;table&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;write (&lt;FONT color=#800080&gt;"&amp;nbsp; &amp;lt;tr&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;write (&lt;FONT color=#800080&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;write (&lt;FONT color=#800080&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/FONT&gt;+content);&lt;BR&gt;write (&lt;FONT color=#800080&gt;"&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;write (&lt;FONT color=#800080&gt;"&amp;nbsp;&amp;nbsp;&amp;lt;/tr&amp;gt;"&lt;/FONT&gt;);&lt;BR&gt;write (&lt;FONT color=#800080&gt;"&amp;lt;/table&amp;gt;"&lt;/FONT&gt;);&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD noWrap&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=1&gt;&lt;FONT color=#800080&gt;&amp;lt;table&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color=#ff0000&gt;&amp;lt;%&lt;/FONT&gt;=Content&lt;FONT color=#ff0000&gt;%&amp;gt;&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#800080 size=1&gt;&amp;lt;/td&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&lt;BR&gt;&amp;lt;/table&amp;gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD noWrap&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=1&gt;Table&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; Table();&lt;BR&gt;TableRow&amp;nbsp; row&amp;nbsp;&amp;nbsp; = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; TableRow();&lt;BR&gt;TableCell cell&amp;nbsp; = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; TableCell();&lt;BR&gt;cell.Controls.Add (&lt;FONT color=#0000ff&gt;new&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;LiteralControl(content));&lt;BR&gt;row.Cells.Add (cell);&lt;BR&gt;table.Rows.Add (row);&lt;BR&gt;this.Controls.Add (table);&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;viable for html creation&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;yes&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;yes&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;yes&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;ease of maintain source&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;easy &lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;easy&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;easy&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;ease of pasting&lt;BR&gt;in sample code&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;difficult&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;easy&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;nearly impossible,&lt;BR&gt;aside from&lt;BR&gt;controls.add(new literalcontrol(&amp;#8220;&amp;#8230;samplecode..&amp;#8221;))&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;presentiment of output&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;yes&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;yes&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;no&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;abstraction level&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;low&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;low&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;high&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;other benefits&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;total flexibility&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;easy to read while developing&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;output to multiple targets&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;application range&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;closed application&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;template based html generation&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;user controls (compiled)&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD colSpan=3&gt;
&lt;P align=center&gt;&lt;EM&gt;Symmetries to application code generation/ using these to generate code instead of html&lt;/EM&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;&lt;A title="Code Generation in Action" href="http://www.codegeneration.net/cgia/"&gt;&lt;A title="Code Generation in Action" href="http://www.codegeneration.net/cgia/"&gt;&lt;A title="Code Generation in Action" href="http://www.codegeneration.net/cgia/"&gt;&lt;A title="Code Generation in Action" href="http://www.codegeneration.net/cgia/"&gt;&lt;A title="Code Generation in Action" href="http://www.codegeneration.net/cgia/"&gt;&lt;a title="Code Generation in Action" href="http://www.codegeneration.net/cgia/" &gt;CGIA&lt;/a&gt;&lt;/A&gt;&lt;/A&gt;&lt;/A&gt;&lt;/A&gt;&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;tier generator&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;tier generator&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;code munger&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;&lt;A title="Code Generation in Microsoft .NET" href="http://www.gendotnet.com/Top%20Level%20Pages/code_gen_in__net.htm"&gt;&lt;A title="Code Generation in Microsoft .NET" href="http://www.gendotnet.com/Top%20Level%20Pages/code_gen_in__net.htm"&gt;&lt;A title="Code Generation in Microsoft .NET" href="http://www.gendotnet.com/Top%20Level%20Pages/code_gen_in__net.htm"&gt;&lt;A title="Code Generation in Microsoft .NET" href="http://www.gendotnet.com/Top%20Level%20Pages/code_gen_in__net.htm"&gt;&lt;a title="Code Generation in Microsoft .NET" href="http://www.gendotnet.com/Top%20Level%20Pages/code_gen_in__net.htm" &gt;KaDGen&lt;/a&gt;&lt;/A&gt;&lt;/A&gt;&lt;/A&gt;&lt;/A&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;brute force&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;not mentioned *&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;codeDOM&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;
&lt;P&gt;primary domain (IMHO)&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;&amp;nbsp;wizard&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;template based code generation&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;P&gt;on the fly code generation,&lt;BR&gt;powerfull in conjunction with parser,&lt;BR&gt;code generation controls?&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;
&lt;P&gt;&lt;FONT size=1&gt;* Using template languages in general&amp;nbsp;is not mentioned in &lt;/FONT&gt;&lt;A title="" href="http://www.gendotnet.com/Top%20Level%20Pages/code_gen_in__net.htm"&gt;&lt;FONT size=1&gt;Code Generation in Microsoft .NET&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=1&gt;. Kathleen targets only XSLT, which is in fact a template language. But it is totally unfair to compare XSLT with &amp;#8220;brute force&amp;#8221; and codeDOM. That&amp;#8217;s like explaining our modern road traffic like this: On the roads you will find trucks, busses and Porsches. And not telling that there are Ford, Mercedes, Toyota and many&amp;nbsp;other cars too. By the way, I like&amp;nbsp;her book very much. Kathleen has done an excellent work. I am just reading her second chapter, extracting Metadata.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9352" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Flashback</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/16/9273.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9273</id><created>2004-03-16T21:14:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;At the end of the last century the corporate homepage of my employer celebrated its fourth birthday. The site was hosted by a provider who didn&amp;#8217;t support any dynamic features like CGI. Most of the pages have been static and have been updated once in two month. There was only one exception; a calendar site that should always be actual. All changes have been transmitted to our external web designer. He adjusted the appropriate HTML page and sent it to our provider.&lt;BR&gt;I was asked to simplify that procedure. At this time I have never written a web page before. I knew the basics and started my first web adventure. I examined the current calendar page and guess what, it was a simple html table included in a customized head and footer. I moved the calendar data to an access database and wrote a small VB6 form. The data was edited in a grid and a click on a button produced the html file and uploaded it to our homepage with ftp. The html creating function looked something like that:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;Public Function MakeHTML(rs As recordset) as string&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim html As String&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;lt;html&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;nbsp; &amp;lt;body&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;table&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; While Not rs.EOF&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;nbsp; &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + rs!Date + " " + rs!event&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;nbsp; &amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs.MoveNext&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Wend&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/table&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;nbsp; &amp;lt;/body&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; html = html + "&amp;lt;/html&amp;gt;"&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MakeHTML=html&lt;BR&gt;End function&lt;BR&gt;&lt;/FONT&gt;&lt;BR&gt;This calendar has been so&amp;nbsp;popular that a subset of this data should have been published to a second internet domain. This page had a different design. Moreover the design of our home page changed frequently too. I changed my approach. I installed PHP locally and batched it from my application to produce the html pages. I can&amp;#8217;t remember the proper PHP syntax, but the templates looked similar to that:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&amp;lt;html&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;body&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;table&amp;gt;&lt;BR&gt;&amp;lt;? php while (not rs-&amp;gt;eof): ?&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;tr&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;td&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;?php echo rs-&amp;gt;fields(&amp;#8220;date&amp;#8221;) +&amp;#8221; &amp;#8220;+ rs-&amp;gt;fields(&amp;#8220;event&amp;#8221;);&amp;nbsp; % &amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/td&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/tr&amp;gt;&lt;BR&gt;&amp;lt;?php &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rs-&amp;gt;MoveNext;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end while; ?&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/table&amp;gt;&lt;BR&gt;&amp;lt;/body&amp;gt;&lt;BR&gt;&amp;lt;/html&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;In my memory the creation of these html files are my really&amp;nbsp;first steps in "code" generation. Ok, the output is not a programming language, just html.&amp;nbsp;We use it daily in our asp.net, asp, php, jsp...pages. Nothing special.&amp;nbsp;&lt;BR&gt;&amp;nbsp;&lt;BR&gt;By the way, until now the calendar is still present in internet. The dates are nowadays maintained in a Windows Sharepoint Service list inside our intranet. XSLT-Stylesheets transform the list on the fly to our customers at our home page.&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9273" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Motivation III: Using XSLT as code generator</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/15/9205.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9205</id><created>2004-03-15T19:29:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;I like XSLT. I use it on several occasions; mostly in asp.net context or sharepoint portal server. I am quit familiar with the XSLT syntax.&lt;/P&gt;
&lt;P&gt;Why start with code generation? It is no "hen or egg" question. The code you want to generate has been written several times by you. .Net has powerful libraries; you complemented them with your own. You refactored your code. But you couldn't avoid writing boring code again and again. You see the repeating pattern and starts to extract the metadata.&lt;/P&gt;
&lt;P&gt;All times I did this; I felt it naturally to write down this metadata in form of XML. No problem to build up hierarchies and transform the XML so it is a real abstraction of your domain. I invent my own tags and I am every time enthusiastic about the result.&lt;/P&gt;
&lt;P&gt;As I mentioned in a post yesterday, my first generator generated ascx User Contols. Because I knew XSLT, it was the self-evident idea to use XSLT to transform XML to a HTML-like syntax. &lt;/P&gt;
&lt;P&gt;Some weeks ago I had to wrap a set of web services with an object model. Writing the second class in this project I&amp;#8217;ve caught the pattern and developed the abstraction as XML. Now I was looking for a code generator that targets C#&amp;nbsp;and searched the web. First hit has been &lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;a title="" href="http://www.ericjsmith.net/codesmith/" target="_blank"&gt;CodeSmith&lt;/a&gt;&lt;/A&gt;&lt;/A&gt;, I installed it and I was really disappointed. I recognized the well known ASP.NET like way, but I was shocked to see that &lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;a title="" href="http://www.ericjsmith.net/codesmith/" target="_blank"&gt;CodeSmith&lt;/a&gt;&lt;/A&gt;&lt;/A&gt; force me to give up my XML representation and to transform it to a .NET based property set. ( to Eric: I studied &amp;#8220;PurchaseOrderXML.cst&amp;#8221;, that is not what I dream of, sorry). I can imagine requirements where &lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;a title="" href="http://www.ericjsmith.net/codesmith/" target="_blank"&gt;CodeSmith&lt;/a&gt;&lt;/A&gt;&lt;/A&gt; will be the tool of my choice; if have to extract the Meta data out of a database or other sources.&lt;/P&gt;
&lt;P&gt;I remembered the XP wisdom &amp;#8220;&lt;A href="http://www.martinfowler.com/articles/designDead.html#N400092"&gt;Do the Simplest Thing that Could Possibly Work&lt;/A&gt;". I know XSLT, it works. I know how to implement my generator using IE and notepad. That is simple. It doesn&amp;#8217;t handicaps me in representing the metadata in its elemental form. Sole constraint: XSLT is different from C# or VB, so you will have a longer learning curve.&lt;/P&gt;
&lt;P&gt;It would be easier (not simpler) to have the generator integrated in my IDE: Visual Studio. That is why I started Greenator. Greenator has yet three different generators built in: XSLT, &amp;#8220;Simple&amp;#8221; and the possibility to configure an external generator like &lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;A title="" href="http://www.ericjsmith.net/codesmith/" target=_blank&gt;&lt;a title="" href="http://www.ericjsmith.net/codesmith/" target="_blank"&gt;CodeSmith&lt;/a&gt;&lt;/A&gt;&lt;/A&gt;. In a later post I will show you my favourite, &amp;#8220;Simple&amp;#8221;.&lt;BR&gt;&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9205" width="1" height="1"&gt;</content><slash:comments>2</slash:comments></entry><entry><title>Code Generation in Microsoft .NET: Generator types</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/15/9186.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9186</id><created>2004-03-15T16:13:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;SPAN lang=EN-GB style="mso-ansi-language: EN-GB"&gt;Today I got the book &lt;a title="" href="http://www.gendotnet.com/Top%20Level%20Pages/code_gen_in__net.htm" &gt;Code Generation in Microsoft .NET&lt;/a&gt;. I was really surprised, I have read the interviews with her at &lt;A title="" href="http://www.codegeneration.net"&gt;Code Generation Network&lt;/A&gt; but I was totally impressed of getting such a huge tome.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN lang=EN-GB style="mso-ansi-language: EN-GB"&gt;In chapter one Kathleen Dollard distinguish between three main types of code generators; "brute force", CodeDOM and XSLT. In a comparison table she evaluates the ease of pasting in sample code: XSLT easy, "brute force" difficult and CodeDOM effectively impossible. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN lang=EN-GB style="mso-ansi-language: EN-GB"&gt;I would agree totally but I think that one technique is totally missing; an ASP.NET like approach like &lt;A href="http://www.ericjsmith.net/codesmith/"&gt;&lt;a title="" href="http://www.ericjsmith.net/codesmith/" target="_blank"&gt;CodeSmith&lt;/a&gt;&lt;/A&gt;, &lt;A href="http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=dfef25fa-f545-4289-b9fc-05270ea41fb3"&gt;M3rlin&lt;/A&gt;, &lt;A href="http://www.devprojects.net/cube.aspx"&gt;Cube&lt;/A&gt; or &lt;A href="http://www.mygenerationsoftware.com/"&gt;MyGeneration&lt;/A&gt;. &lt;a title="" href="http://www.ericjsmith.net/codesmith/" target="_blank"&gt;CodeSmith&lt;/a&gt; and Cube uses "brute force" as engine behind, Cube loads the ASP.NET engine. Pasting in sample code into the templates is easy; the principle is powerful and familiar to all .NET users.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN lang=EN-GB style="mso-ansi-language: EN-GB"&gt;I prefer the way of XSLT, mainly because you are not "overlaying the syntax of the output code with the code that runs the template".&amp;nbsp; But I will not ignore ASP.LIKE techniques.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN lang=EN-GB style="mso-ansi-language: EN-GB"&gt;I can&amp;#8217;t wait to read on.&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9186" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Greenator Features: Visual Studio .Net integration</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/14/9120.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9120</id><created>2004-03-14T21:40:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;&lt;IMG src="/WebLog/images/dotnetjunkies_com/culllog/868/r_CustomTool.jpg" align=right&gt; VS .NET has&amp;nbsp;a built in interface for integrating Code Generation called custom tool. Two Custom Tools (also called Generators) come with VS.NET, MSDataSetGenerator for strongly-typed DataSets, and MSDiscoCodeGenerator for WebService proxy classes.&lt;/P&gt;
&lt;P&gt;Once you have set the property custom tool the generator starts and generates a subordinate project item with the generated source. Every time you change and save&amp;nbsp;your base definition file,&amp;nbsp;&amp;nbsp;the source file is generated again.&lt;/P&gt;
&lt;P&gt;I like the transparent way how the generation works. In fact, at first sight&amp;nbsp;it is&amp;nbsp;a miracle&amp;nbsp;how the&amp;nbsp;strongly typed dataset is generated from a Schema.&lt;/P&gt;
&lt;P&gt;It is possible &lt;A href="http://drewnoakes.com/snippets/WritingACustomCodeGeneratorToolForVisualStudio/"&gt;to write your own custom tools&lt;/A&gt;. All you need is to implement one function:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=1&gt;&lt;FONT color=#0000ff&gt;public override&lt;/FONT&gt; byte[] GenerateCode(string file, string contents)&lt;BR&gt;{&lt;BR&gt;string code = "&amp;lt;&amp;lt;generated code&amp;gt;&amp;gt;";&lt;BR&gt;&lt;FONT color=#0000ff&gt;return&lt;/FONT&gt; System.Text.Encoding.ASCII.GetBytes(code);&lt;BR&gt;}&lt;/FONT&gt;&lt;/FONT&gt;&lt;BR&gt;&lt;BR&gt;On&amp;nbsp;a second sight, this approach limits the scope for&amp;nbsp;active code generation. Code generation should be under your control, you should e.g. set the templates to be used for the code generation. It is not possible to set a further argument inside the properties of the definition file.&lt;/P&gt;
&lt;P&gt;Some code generators that implement custom tool cheat; they add the reference of the template inside the model definition. That is not orthogonal.&lt;/P&gt;
&lt;P&gt;Furthermore it is not possible to generate two code files out of one model.&lt;/P&gt;
&lt;P&gt;Greenator is&amp;nbsp;written as Visual Studio Add-In and for this reason&amp;nbsp;Greenator is not limited by the design of custom tool.&amp;nbsp;But Greenator&amp;nbsp;supplements custom tools&amp;nbsp;behaviour, it watches all templates and models and generates the code file or even files transparent on the fly every time it must. &lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9120" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Motivation II</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/14/9089.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9089</id><created>2004-03-14T20:00:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;I used consciously code generation one year ago. Nearly every day I was asked to implement and publish another contact form at our company&amp;#8217;s homepage: Address fields, email address, custom validations&amp;#8230;Actual a common task, but none of these forms looked like another, all of them asked for at least one different field. It was a stupid and boring. The approach was simple too: The form definition has been reduced to a xml based model. I used XSLT successful to transform these models to .ascx user controls. &lt;/P&gt;
&lt;P&gt;The model files have been maintained by some power users. They did not know much about XML, but they have been able to alter existing model files to their needs. My function was reduced to validate the assigned model, to run the transformation and to publish the output to&amp;nbsp;a web server. The time was reduced from about one hour per form to few minutes. As a side effect oversights diasppeared.&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9089" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry><entry><title>Motivation</title><link rel="alternate" type="text/html" href="http://www.dotnetjunkies.com/WebLog/culllog/archive/2004/03/14/9083.aspx" /><id>58df7014-fd75-437c-9641-150997716d1c:9083</id><created>2004-03-14T18:51:00Z</created><content type="text/html" mode="escaped">&lt;P&gt;Did&amp;nbsp;you ever have a "Deja vu" in your daily programming live? Do you have too the feeling of repeating again and again similar lines of code? Do you used to&amp;nbsp;copy and paste&amp;nbsp;your source code?&lt;/P&gt;
&lt;P&gt;No? You must be lucky. Perhaps you are using&amp;nbsp;a language like ruby, &lt;A href="http://www.codegeneration.net/tiki-read_article.php?articleId=9"&gt;which is dynamic enough to let be do what you want without leaving the language&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Yes? But you worked hard, you have powerfull libraries. You have &lt;A href="http://www.refactoring.com/catalog/index.html"&gt;refactored&lt;/A&gt;&amp;nbsp;your code&amp;nbsp;again and again, but this feeling never moved away? &lt;/P&gt;
&lt;P&gt;Now its time for &lt;A href="http://www.artima.com/intv/dry2.html"&gt;Code Generation&lt;/A&gt;!&lt;/P&gt;&lt;img src="http://www.dotnetjunkies.com/WebLog/aggbug.aspx?PostID=9083" width="1" height="1"&gt;</content><slash:comments>0</slash:comments></entry></feed>