<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.Net</title>
        <link>http://www.agilior.pt/blogs/pedro.rainho/category/44.aspx</link>
        <description>.Net</description>
        <language>pt-PT</language>
        <copyright>Pedro Rainho</copyright>
        <managingEditor>pedro.rainho@agilior.pt</managingEditor>
        <generator>Subtext Version 1.9.0.27</generator>
        <item>
            <title>Exception across App Domains</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/24/7397.aspx</link>
            <description>&lt;p&gt;Recently I had a very strange exception and took me some time to figure out what was the problem. So lets imagine that I want to execute a piece of code in a different app domain, lets call it “NewDomain”, and that NewDomain throws a custom exception “MyException”.&lt;/p&gt;  &lt;p&gt;The code of MyException is this:&lt;/p&gt;  &lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Serializable&lt;/span&gt;]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MyException &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;ApplicationException
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public &lt;/span&gt;MyException()
        : &lt;span style="color: blue"&gt;base&lt;/span&gt;()
    {
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;MyException(&lt;span style="color: blue"&gt;string &lt;/span&gt;message)
        : &lt;span style="color: blue"&gt;base&lt;/span&gt;(message)
    {
        myCustomMessage = &lt;span style="color: #a31515"&gt;"Dear user you got an exception: " &lt;/span&gt;+ message;
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;MyException(&lt;span style="color: blue"&gt;string &lt;/span&gt;message, &lt;span style="color: #2b91af"&gt;Exception &lt;/span&gt;innerException)
        :
        &lt;span style="color: blue"&gt;base&lt;/span&gt;(message, innerException)
    {
        myCustomMessage = &lt;span style="color: #a31515"&gt;"Dear user you got an exception: " &lt;/span&gt;+ message;
    }

    &lt;span style="color: blue"&gt;public override string &lt;/span&gt;Message
    {
        &lt;span style="color: blue"&gt;get
        &lt;/span&gt;{
            &lt;span style="color: blue"&gt;return &lt;/span&gt;myCustomMessage;
        }
    }

    &lt;span style="color: blue"&gt;private string &lt;/span&gt;myCustomMessage;
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;If this exception is thrown across app domains you will get this nice exception: &lt;/p&gt;

&lt;p&gt;The constructor to deserialize an object of type 'MyException’ was not found.&lt;/p&gt;

&lt;p&gt;Server stack trace:&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Serialization.ObjectManager.DoFixups()&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeMessageParts(MemoryStream stm)&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Remoting.Messaging.SmuggledMethodReturnMessage.FixupForNewAppDomain()&lt;/p&gt;

&lt;p&gt;   at System.Runtime.Remoting.Channels.CrossAppDomainSink.SyncProcessMessage(IMessage reqMsg)&lt;/p&gt;

&lt;p&gt;…&lt;/p&gt;

&lt;p&gt;I didn’t know what the problem was at the beginning, because my class was marked with the attribute &lt;span style="color: #2b91af"&gt;Serializable &lt;/span&gt;so what was the real problem??? &lt;/p&gt;

&lt;p&gt;The problem happens because I was transmitting the exception object across a stream. And across streams mark the class as &lt;span style="color: #2b91af"&gt;Serializable &lt;/span&gt;is not enough.&lt;/p&gt;

&lt;p&gt;So the solution is actually simple.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;I need to add a protected constructor with the following signature&lt;/li&gt;

  &lt;ol&gt;
    &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected &lt;/span&gt;MyException(&lt;span style="color: #2b91af"&gt;SerializationInfo &lt;/span&gt;info, &lt;span style="color: #2b91af"&gt;StreamingContext &lt;/span&gt;context)&lt;/pre&gt;
  &lt;/ol&gt;

  &lt;li class="code"&gt;My MyException class needs to implement ISerializable, the class System.Exception already implements it&lt;/li&gt;

  &lt;li class="code"&gt;I need to implement the method&lt;/li&gt;

  &lt;ol&gt;
    &lt;pre class="code"&gt;GetObjectData(&lt;span style="color: #2b91af"&gt;SerializationInfo &lt;/span&gt;info, &lt;span style="color: #2b91af"&gt;StreamingContext &lt;/span&gt;context)&lt;/pre&gt;
  &lt;/ol&gt;

  &lt;li class="code"&gt;Attribute the method with the following attribute&lt;/li&gt;

  &lt;ol&gt;
    &lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;SecurityPermissionAttribute&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;SecurityAction&lt;/span&gt;.Demand, SerializationFormatter = &lt;span style="color: blue"&gt;true&lt;/span&gt;)]&lt;/pre&gt;
    &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/ol&gt;
&lt;/ol&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;I need all of this because the constructor is called during deserialization to reconstitute the exception object transmitted over a stream, and I need the method GetObjectData because I need to serialize my fields.&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;So, MyException class will lock like this:&lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Serializable&lt;/span&gt;]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MyException &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;ApplicationException
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public &lt;/span&gt;MyException()
        : &lt;span style="color: blue"&gt;base&lt;/span&gt;()
    {
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;MyException(&lt;span style="color: blue"&gt;string &lt;/span&gt;message)
        : &lt;span style="color: blue"&gt;base&lt;/span&gt;(message)
    {
        myCustomMessage = &lt;span style="color: #a31515"&gt;"Dear user you got an exception: " &lt;/span&gt;+ message;
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;MyException(&lt;span style="color: blue"&gt;string &lt;/span&gt;message, &lt;span style="color: #2b91af"&gt;Exception &lt;/span&gt;innerException)
        :
        &lt;span style="color: blue"&gt;base&lt;/span&gt;(message, innerException)
    {
        myCustomMessage = &lt;span style="color: #a31515"&gt;"Dear user you got an exception: " &lt;/span&gt;+ message;
    }

    &lt;span style="color: blue"&gt;protected &lt;/span&gt;MyException(&lt;span style="color: #2b91af"&gt;SerializationInfo &lt;/span&gt;info, &lt;span style="color: #2b91af"&gt;StreamingContext &lt;/span&gt;context)
        : &lt;span style="color: blue"&gt;base&lt;/span&gt;(info, context)
    {
        myCustomMessage = info.GetString(&lt;span style="color: #a31515"&gt;"myCustomMessage"&lt;/span&gt;);
    }

    [&lt;span style="color: #2b91af"&gt;SecurityPermissionAttribute&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;SecurityAction&lt;/span&gt;.Demand, SerializationFormatter = &lt;span style="color: blue"&gt;true&lt;/span&gt;)]
    &lt;span style="color: blue"&gt;public override void &lt;/span&gt;GetObjectData(&lt;span style="color: #2b91af"&gt;SerializationInfo &lt;/span&gt;info, &lt;span style="color: #2b91af"&gt;StreamingContext &lt;/span&gt;context)
    {
        info.AddValue(&lt;span style="color: #a31515"&gt;"myCustomMessage"&lt;/span&gt;, myCustomMessage);

        &lt;span style="color: blue"&gt;base&lt;/span&gt;.GetObjectData(info, context);
    }

    &lt;span style="color: blue"&gt;public override string &lt;/span&gt;Message
    {
        &lt;span style="color: blue"&gt;get
        &lt;/span&gt;{
            &lt;span style="color: blue"&gt;return &lt;/span&gt;myCustomMessage;
        }
    }

    &lt;span style="color: blue"&gt;private string &lt;/span&gt;myCustomMessage;
}&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Like I wrote I just had to implement a constructor  to deserialize my fields  and a method to serialize them.&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/7397.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/24/7397.aspx</guid>
            <pubDate>Tue, 24 Mar 2009 07:35:36 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/7397.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/24/7397.aspx#feedback</comments>
            <slash:comments>10</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/7397.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Load and unload assemblies</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/15/7328.aspx</link>
            <description>&lt;p&gt;Last week, I had a problem that probably some .Net developer had faced. The problem consists in load and unload an assembly?.&lt;/p&gt;  &lt;p&gt;Can I do that??? Well, I can’t do it in a simple way. One of the things that Assembly doesn’t support in unload, check this &lt;a href="http://blogs.msdn.com/jasonz/archive/2004/05/31/145105.aspx"&gt;post&lt;/a&gt; to see why. &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;So, like I wrote, last week I was developing a new feature for a software factory and that feature consisted in get all references and do something else. &lt;/p&gt;  &lt;p&gt;My recipe does something like this:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Get project assembly &lt;/li&gt;    &lt;li&gt;Copy the assembly DLL to a location &lt;/li&gt;    &lt;li&gt;Get all assembly references &lt;/li&gt;    &lt;li&gt;Generate a file &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Do number 1 is simple.&lt;/p&gt;  &lt;p&gt;Do number 2 is also simple, but has a problem.&lt;/p&gt;  &lt;p&gt;Do number 3 is also simple, but has a problem.&lt;/p&gt;  &lt;p&gt;Do number 4 is simple.&lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;I’m going to explain first problem number 3 then problem 2&lt;/p&gt;  &lt;p&gt;The problem with number 3 it’s because I load a assembly and they I get referenced assemblies. To get referenced assemblies I just do:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;Assembly &lt;/span&gt;assembly = &lt;span style="color: #2b91af"&gt;Assembly&lt;/span&gt;.LoadFrom(&lt;span style="color: #a31515"&gt;@"c:\myAssembly.dll"&lt;/span&gt;);
&lt;span style="color: #2b91af"&gt;AssemblyName&lt;/span&gt;[] references = assembly.GetReferencedAssemblies();&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This piece of code has a problem, since I’m loading the assembly and they get referenced assemblies the file myAssembly.dll is now locked this means that the next time I try to  run number 2 I will get an exception and the file will not ne copied. And this is why I had problem  number 2.&lt;/p&gt;

&lt;p&gt;Now, how can I load the assembly and then unload that assembly so the file won’t be locked???&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;I came across some solutions.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;One of the possible solutions is just copy the assembly to something unique like {GUID}.DLL and then load that {GUID}.DLL, and do everything I need to do, this way I won’t lock my file. 
    &lt;ol&gt;
      &lt;li&gt;Problem: I will have the assembly {GUID}.DLL loaded (in memory) every time, and can’t delete file {GUID}.DLL, because it’s locked. And finally I can’t unload unless I close Visual Studio. &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;

  &lt;li&gt;Why don’t I just load the assembly into an array of bytes and then load the assembly, like this: 
    &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;Assembly &lt;/span&gt;assembly = &lt;span style="color: #2b91af"&gt;Assembly&lt;/span&gt;.Load(&lt;span style="color: #2b91af"&gt;File&lt;/span&gt;.ReadAllBytes(&lt;span style="color: #a31515"&gt;@"c:\myAssembly.dll"&lt;/span&gt;));&lt;/pre&gt;
    &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

    &lt;ol&gt;
      &lt;li&gt;Problem: I can do this and my file will not be locked but that array of bytes will be in memory and my visual studio memory will grow every time I run that recipe. That memory will be released only when I close the Visual Studio. &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;

  &lt;li&gt;I can load the assembly in a new AppDomain and then unload the AppDomain. 
    &lt;ol&gt;
      &lt;li&gt;Problem: tThis was a strange problem and I don’t know why but I load the assembly in a new AppDomain and that assembly become part of the new AppDomain and the AppDomain.Current. This was strange. Don’t know if I was doing something wrong. Now since the Assembly is loaded in AppDomain.Current I wasn’t able to copy the file, because it was locked. &lt;/li&gt;
    &lt;/ol&gt;
  &lt;/li&gt;

  &lt;li&gt;The last solution I came across to load the assembly and unload it. This solution Consists in create a new AppDomain and then use method DoCallBack: &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Here it is the source code:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;AppDomainSetup &lt;/span&gt;setup = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AppDomainSetup&lt;/span&gt;();
setup.ApplicationBase = ApplicationBasePath;

&lt;span style="color: #2b91af"&gt;AppDomain &lt;/span&gt;newDomainReferences = &lt;span style="color: #2b91af"&gt;AppDomain&lt;/span&gt;.CreateDomain(&lt;span style="color: #a31515"&gt;"AppDomain"&lt;/span&gt;, &lt;span style="color: blue"&gt;null&lt;/span&gt;, setup);

CallBackAssemblyReferences call = &lt;span style="color: blue"&gt;new &lt;/span&gt;CallBackAssemblyReferences(newDomainReferences, filepath);
newDomainReferences.DoCallBack(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CrossAppDomainDelegate&lt;/span&gt;(call.LoadAssemblyReferences));
&lt;span style="color: #2b91af"&gt;AssemblyName&lt;/span&gt;[] assName = (&lt;span style="color: #2b91af"&gt;AssemblyName&lt;/span&gt;[])newDomainReferences.GetData(&lt;span style="color: #a31515"&gt;"AssemblyReferences"&lt;/span&gt;);

&lt;span style="color: #2b91af"&gt;AppDomain&lt;/span&gt;.Unload(newDomainReferences);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This solution enables me to do a callback in a different domain. My class CallBackAssemblyReferences just does this:&lt;/p&gt;

&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;Serializable&lt;/span&gt;]
&lt;span style="color: blue"&gt;internal class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CallBackAssemblyReferences
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;#region &lt;/span&gt;Members Variables
    &lt;span style="color: blue"&gt;private string &lt;/span&gt;assemblyFile;
    &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AppDomain &lt;/span&gt;domain;
    &lt;span style="color: blue"&gt;#endregion

    #region &lt;/span&gt;Public Implementation
    &lt;span style="color: blue"&gt;public &lt;/span&gt;CallBackAssemblyReferences()
    {

    }
    &lt;span style="color: blue"&gt;public &lt;/span&gt;CallBackAssemblyReferences(&lt;span style="color: #2b91af"&gt;AppDomain &lt;/span&gt;domain, &lt;span style="color: blue"&gt;string &lt;/span&gt;assemblyFile)
    {
        &lt;span style="color: blue"&gt;this&lt;/span&gt;.assemblyFile = assemblyFile;
        &lt;span style="color: blue"&gt;this&lt;/span&gt;.domain = domain;
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;LoadAssemblyReferences()
    {
        &lt;span style="color: #2b91af"&gt;Assembly &lt;/span&gt;assembly = &lt;span style="color: blue"&gt;this&lt;/span&gt;.domain.Load(&lt;span style="color: #2b91af"&gt;AssemblyName&lt;/span&gt;.GetAssemblyName(&lt;span style="color: blue"&gt;this&lt;/span&gt;.assemblyFile));

        domain.SetData(&lt;span style="color: #a31515"&gt;"AssemblyReferences"&lt;/span&gt;, assembly.GetReferencedAssemblies());
    }
    &lt;span style="color: blue"&gt;#endregion
&lt;/span&gt;}&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This class has a constructor that receives the new domain I’m working on and the path to the assembly I want to load. &lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;CallBackAssemblyReferences(&lt;span style="color: #2b91af"&gt;AppDomain &lt;/span&gt;domain, &lt;span style="color: blue"&gt;string &lt;/span&gt;assemblyFile) &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Then I just have my callback method WITH NO PARAMETERS. &lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;LoadAssemblyReferences() &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;This is the method that will be called when I do &lt;/p&gt;

&lt;p&gt;newDomainReferences.DoCallBack(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CrossAppDomainDelegate&lt;/span&gt;(call.LoadAssemblyReferences)); &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The callback method only loads the assembly in the new domain and then sets data in the new domain. These data are the assembly references. &lt;/p&gt;

&lt;p&gt;When the DoCallBack returns I just had to do &lt;/p&gt;

&lt;p&gt;&lt;span style="color: #2b91af"&gt;AssemblyName&lt;/span&gt;[] assName = (&lt;span style="color: #2b91af"&gt;AssemblyName&lt;/span&gt;[])newDomainReferences.GetData(&lt;span style="color: #a31515"&gt;"AssemblyReferences"&lt;/span&gt;);&lt;/p&gt;

&lt;p&gt;To get the references I had saved. &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Finally I just unload the AppDomain. &lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;Now I can run my recipe every time I need without lock the file and without decrease visual studio performance.&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/7328.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/15/7328.aspx</guid>
            <pubDate>Sun, 15 Mar 2009 17:59:14 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/7328.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/15/7328.aspx#feedback</comments>
            <slash:comments>33</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/7328.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Moq.me</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/08/7229.aspx</link>
            <description>&lt;p&gt;Currently when I need do unit tests the mock framework that I’m currently using Is the &lt;a href="http://ayende.com/projects/rhino-mocks.aspx"&gt;Rhino Mocks&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;But today after read a post, I found a new mock framework, named &lt;a href="http://code.google.com/p/moq/downloads/list"&gt;Moq.me&lt;/a&gt;. This framework was made by &lt;a href="http://www.clariusconsulting.net/blogs/kzu/"&gt;kzu&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.clariusconsulting.net/blogs/kzu/"&gt;kzu&lt;/a&gt; is one of the guys behind &lt;a href="http://www.clariusconsulting.net"&gt;Clarius&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;I know &lt;a href="http://www.clariusconsulting.net"&gt;Clarius&lt;/a&gt; because I develop software factories and they have this toolkit, that I had tried, named &lt;a href="http://www.softwarefactoriestoolkit.net/"&gt;Clarius Software Factory Toolkit&lt;/a&gt; and it’s a “software factory to do other software factories”. They also have the &lt;a href="http://www.visualt4.com/"&gt;Clarius Visual T4&lt;/a&gt;(aka T4 Editor). &lt;/p&gt;  &lt;p&gt;Now I have download &lt;a href="http://code.google.com/p/moq/downloads/list"&gt;Moq.me&lt;/a&gt; and will test it very very soon :)&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/7229.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/08/7229.aspx</guid>
            <pubDate>Sun, 08 Mar 2009 10:42:10 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/7229.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/03/08/7229.aspx#feedback</comments>
            <slash:comments>99</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/7229.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Error during install of SQL Server 2008</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/23/7093.aspx</link>
            <description>&lt;p&gt;If you ever have this error:&lt;/p&gt;
&lt;p&gt;“The file C:\Windows\Microsoft.NET\Framework\&lt;var&gt;version_number&lt;/var&gt;\mscorlib.tlb could not be loaded. An attempt to repair this condition failed because the file could not be found. Please reinstall this program.”&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;During the install of SQL Server 2005 or SQL Server 2008 here is the solution. &lt;a href="http://support.microsoft.com/default.aspx/kb/918685"&gt;Link&lt;/a&gt;&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/7093.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/23/7093.aspx</guid>
            <pubDate>Mon, 23 Feb 2009 19:54:59 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/7093.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/23/7093.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/7093.aspx</wfw:commentRss>
        </item>
        <item>
            <title>My list of podcasts</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/19/6997.aspx</link>
            <description>&lt;p&gt;Today I’ve decided to share here my list of podcasts. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Here is the list:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Alt.NET Podcast by Mike Moore &lt;/li&gt;
    &lt;li&gt;ASP.NET Podcast by Wallace B. McClure &lt;/li&gt;
    &lt;li&gt;Deep Fried Bytes by Keith Elder &amp;amp; Chris Woodruff &lt;/li&gt;
    &lt;li&gt;Digital Planet by BBC World Service &lt;/li&gt;
    &lt;li&gt;Hansel Minutes by Scott Hanselman &lt;/li&gt;
    &lt;li&gt;Herding Code &lt;/li&gt;
    &lt;li&gt;.Net Rocks! by Carl Franklin &lt;/li&gt;
    &lt;li&gt;Polymorphic Podcast by Craig Shoemaker &lt;/li&gt;
    &lt;li&gt;Sparkling Client by Monica Mork and Erik Mork &lt;/li&gt;
    &lt;li&gt;StevePavlina.com by Steve Pavlina &lt;/li&gt;
    &lt;li&gt;ThoughtWorks - IT Matters Podcast &lt;/li&gt;
    &lt;li&gt;TWiT.TV &lt;/li&gt;
    &lt;li&gt;The Web 2.0 Show by Josh Owens and Adam Stacoviak &lt;/li&gt;
    &lt;li&gt;TSF - Mundo Digital &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Hope someone add some comments with some url to other podcasts.&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/6997.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/19/6997.aspx</guid>
            <pubDate>Thu, 19 Feb 2009 17:00:53 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/6997.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/19/6997.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/6997.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Can any one use the site &amp;ldquo;http://www.precoscombustiveis.dgge.pt/&amp;rdquo; without having errors??? Part 3</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6988.aspx</link>
            <description>&lt;p&gt;While I was using the site I found a NEW kind of error&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneuset.ptwithouthavingerrorsPart3_BF1E/image_2.png"&gt;&lt;img height="385" border="0" width="747" title="image" style="border: 0px none ; display: inline;" alt="image" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneuset.ptwithouthavingerrorsPart3_BF1E/image_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I typed “Paço d’arcos” in the search box. For those who don’t know Paço d’arcos Is near Oeiras. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;And this friendly site searches for Paço d’arcos and shows a maps positioned near “Santa Maria da Feira” that is in north of Portugal, it’s like I search for “New york” and map pointed my to north pole… I don’t know if I should be impressed or sad how my money is being spent.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I done my homework and search in google maps just to see if Paço d’arcos is in fact near Oeiras and it is :)&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Does any one ever test this site before go online ????&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/6988.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6988.aspx</guid>
            <pubDate>Wed, 18 Feb 2009 10:35:40 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/6988.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6988.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/6988.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Can any one use the site &amp;ldquo;http://www.precoscombustiveis.dgge.pt/&amp;rdquo; without having errors??? Part 2</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6987.aspx</link>
            <description>&lt;p&gt;While TRYING to navigate the site I saw errors after errors. but this error is new:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneuset.ptwithouthavingerrorsPart2_BC22/image_2.png"&gt;&lt;img height="326" border="0" width="784" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneuset.ptwithouthavingerrorsPart2_BC22/image_thumb.png" alt="image" style="border: 0px none ; display: inline;" title="image" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Why are the site trying to create folders while I'm navigating???? that is a nice question&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/6987.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6987.aspx</guid>
            <pubDate>Wed, 18 Feb 2009 10:21:12 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/6987.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6987.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/6987.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Can any one use the site &amp;ldquo;http://www.precoscombustiveis.dgge.pt/&amp;rdquo; without having errors???</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6986.aspx</link>
            <description>&lt;p&gt;Here in Portugal the governors decided to spend public money doing a site that, most of the time, doesn’t work. At least that is my opinion.&lt;/p&gt;
&lt;p&gt;I only had spent in the site no more that 3-4 minutes and found some curious errors. I decide to share one of the error that I found.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Here is the screen shoots and how to reproduce one of the bug.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneusethesit.ptwithouthavingerrors_B8C1/image_2.png"&gt;&lt;img height="445" border="0" width="865" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneusethesit.ptwithouthavingerrors_B8C1/image_thumb.png" alt="image" style="border-width: 0px; display: inline;" title="image" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I select “Castelo Branco” and the I choose “Seleccionar todos os municipios deste distrito”, and what happens…&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneusethesit.ptwithouthavingerrors_B8C1/image_4.png"&gt;&lt;img height="476" border="0" width="869" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/Cananyoneusethesit.ptwithouthavingerrors_B8C1/image_thumb_1.png" alt="image" style="border-width: 0px; display: inline;" title="image" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I love this error I can imagine users that are not programmers trying to understand this error message :) the message is sooooo expressive :).&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;This is where our governors spend our money…&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;But let’s check the error message just for seeing if it says something usefull. hooo and by the way I’ve formatted the message in the messagebox it’s more easy to read :)&lt;/p&gt;
&lt;code&gt;&lt;style type="text/css"&gt;&lt;![CDATA[



        	body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 

        	p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}

        	b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}

        	h1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

        	h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }

        	pre {font-family:"Lucida Console";font-size: .9em}

        	.marker {font-weight: bold; color: black;text-decoration: none;}

        	.version {color: gray;}

        	.error {margin-bottom: 10px;}

        	.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

        ]]&gt;&lt;/style&gt;&lt;span&gt;
&lt;h1&gt;Server Error in '/' Application.        &lt;hr color="#c0c0c0" width="100%" size="1" /&gt;
&lt;/h1&gt;
&lt;h2&gt;&lt;em&gt;The ConnectionString property has not been initialized.&lt;/em&gt; &lt;/h2&gt;
&lt;/span&gt;&lt;font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt;&lt;strong&gt;Description: &lt;/strong&gt;An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.       &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Exception Details: &lt;/strong&gt;System.InvalidOperationException: The ConnectionString property has not been initialized.       &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Source Error:&lt;/strong&gt;       &lt;br /&gt;
&lt;br /&gt;
&lt;table bgcolor="#ffffcc" width="100%"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;code&gt;               &lt;/code&gt;
            &lt;pre&gt; Line 11:     CMD = New OdbcCommand  Line 12:     CMD.Connection = CN  &lt;font color="red"&gt;Line 13: 		CN.Open()&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;Line 14:     &lt;br /&gt;&lt;br /&gt;Line 15:     If Request("mh") = "" OrElse Request("mh") = "1" Then&lt;/pre&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
&lt;strong&gt;Source File: &lt;/strong&gt;D:\Inetpub\wwwroot\DGEGPOSTOS2008\include\mapaPTDB.aspx&lt;strong&gt;    Line: &lt;/strong&gt;13       &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Stack Trace:&lt;/strong&gt;       &lt;br /&gt;
&lt;br /&gt;
&lt;table bgcolor="#ffffcc" width="100%"&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;code&gt;               &lt;/code&gt;
            &lt;pre&gt; [InvalidOperationException: The ConnectionString property has not been initialized.]     &lt;br /&gt;System.Data.Odbc.OdbcConnection.Open() +741    &lt;br /&gt; ASP.mapaPTCB_aspx.LeZonas() in D:\Inetpub\wwwroot\DGEGPOSTOS2008\include\mapaPTDB.aspx:13     &lt;br /&gt;ASP.mapaPTCB_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in D:\Inetpub\wwwroot\DGEGPOSTOS2008\include\mapaPTCB.aspx:5     &lt;br /&gt;System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27     &lt;br /&gt;System.Web.UI.Control.Render(HtmlTextWriter writer) +7     &lt;br /&gt;System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243     &lt;br /&gt;System.Web.UI.Page.ProcessRequestMain() +1926&lt;/pre&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;       &lt;br /&gt;
&lt;/p&gt;
&lt;p&gt;       &lt;/p&gt;
&lt;hr color="#c0c0c0" width="100%" size="1" /&gt;
&lt;p&gt;&lt;strong&gt;Version Information:&lt;/strong&gt; Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032 &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;!-- 

[InvalidOperationException]: The ConnectionString property has not been initialized.

   at System.Data.Odbc.OdbcConnection.Open()

   at ASP.mapaPTCB_aspx.LeZonas() in D:\Inetpub\wwwroot\DGEGPOSTOS2008\include\mapaPTDB.aspx:line 13

   at ASP.mapaPTCB_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in D:\Inetpub\wwwroot\DGEGPOSTOS2008\include\mapaPTCB.aspx:line 5

   at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer)

   at System.Web.UI.Control.Render(HtmlTextWriter writer)

   at System.Web.UI.Control.RenderControl(HtmlTextWriter writer)

   at System.Web.UI.Page.ProcessRequestMain()

[HttpUnhandledException]: Exception of type System.Web.HttpUnhandledException was thrown.

   at System.Web.UI.Page.HandleError(Exception e)

   at System.Web.UI.Page.ProcessRequestMain()

   at System.Web.UI.Page.ProcessRequest()

   at System.Web.UI.Page.ProcessRequest(HttpContext context)

   at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()

   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)

--&gt;&lt;!-- 

This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using &amp;lt;customErrors mode="Off"/&amp;gt;. Consider using &amp;lt;customErrors mode="On"/&amp;gt; or &amp;lt;customErrors mode="RemoteOnly"/&amp;gt; in production environments.--&gt;&lt;/font&gt;Interesting message especially the part that says OdbcCommand. What are they using as data bases… are they using MS Access as there data base or a CSV text file ????… that is a really nice question.&lt;/code&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The other thing that I see is that there site is located in D:\Inetpub\wwwroot\DGEGPOSTOS2008\include hummm and the have a file called mapaPTDB.aspx that has a error on line 13 probably a missing a text file :)&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Continuing with the error I see a message “The ConnectionString property has not been initialized.” hummm a public site sponsored by public money and some one forget to initialize correctly the connection string… &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Continuing analyzing the error I see .NET Framework Version 1.1.4322.2032; ASP.NET Version 1.1.4322.2022… hummm analyzing these versions they also probably forget to apply Framework 1.1 SP1 &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;I’m impressed how the governor invest my and others money. &lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/6986.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6986.aspx</guid>
            <pubDate>Wed, 18 Feb 2009 10:08:24 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/6986.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/18/6986.aspx#feedback</comments>
            <slash:comments>8</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/6986.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Software Factory &amp;ndash; Guidance Migration from Visual Studio 2005 to Visual Studio 2008</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/06/6880.aspx</link>
            <description>&lt;p&gt;Before begin I have to give some credit to my friend &lt;a href="http://www.agilior.pt/blogs/rodrigo.guerreiro"&gt;Rodrigo Guerreiro&lt;/a&gt; because he helped me with this PROBLEM.&lt;/p&gt;
&lt;p&gt;First I can say that I wasn’t able to find ANY information in internet about migration. Don’t know if I was looking in the wrong sites but i wasn’t able to find any information.&lt;/p&gt;
&lt;p&gt;Now this post reflect what I did in order to create 2 MSI’s files that can be installed in Visual Studio 2005 and Visual Studio 2008. (One MSI to install in VS2005 and another to install in VS2008)&lt;/p&gt;
&lt;p&gt;Notice that I didn’t had to migrate my solution to VS2008 in order to create a MSI that installs a factory in VS2008&lt;/p&gt;
&lt;p&gt;These was my steps:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Go to the solution folder and, in my case, there was a folder with the project setup. What I did was copy that folder and rename it from XXXSetup to XXXSetup2008.
    &lt;ol&gt;
        &lt;li&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_2.png"&gt;&lt;img height="42" border="0" width="180" title="image" style="border-width: 0px; display: inline;" alt="image" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_thumb.png" /&gt;&lt;/a&gt; &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/li&gt;
    &lt;li&gt;Inside the folder XXXSetup2008 I rename the file XXXSetup.vdproj to XXXSetup2008.vdproj
    &lt;ol&gt;
        &lt;li&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_4.png"&gt;&lt;img height="24" border="0" width="244" title="image" style="border-width: 0px; display: inline;" alt="image" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_thumb_1.png" /&gt;&lt;/a&gt; &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/li&gt;
    &lt;li&gt;Then I edit file XXXSetup2008.vdproj (With notepad :)) and every place I had XXXSetup I rename it to XXXsetup2008 (Very Careful with this point because you can mess up with the project and start from the begining). In my case I just had to do this renames:
    &lt;ol&gt;
        &lt;li&gt;"ProjectName" = "8:XXXSetup" para "ProjectName" = "8:XXXSetup2008" &lt;/li&gt;
        &lt;li&gt;"OutputFilename" = "8:Release\\XXXSetup.msi" para "OutputFilename" = "8:Release\\XXXSetup2008.msi" &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/li&gt;
    &lt;li&gt;After this I open the solution in VS2005 and added the project XXXSetup2008.vdproj to my solution
    &lt;ol&gt;
        &lt;li&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_6.png"&gt;&lt;img height="39" border="0" width="190" title="image" style="border-width: 0px; display: inline;" alt="image" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_thumb_2.png" /&gt;&lt;/a&gt;  &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/li&gt;
    &lt;li&gt;With the project XXXSetup2008 selected.
    &lt;ol&gt;
        &lt;li&gt;In the solution explorer choose “Custom Actions Editor” icon
        &lt;ol&gt;
            &lt;li&gt;A window will open with the following custom actions              &lt;br /&gt;
            -- GuidancePackage[Install], [commit], [roolback], [uninstall]               &lt;br /&gt;
            &lt;br /&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_8.png"&gt;&lt;img height="436" border="0" width="850" title="image" style="border-width: 0px; display: inline;" alt="image" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image_thumb_3.png" /&gt;&lt;/a&gt;  &lt;br /&gt;
            &lt;/li&gt;
            &lt;li&gt;Click in every single one and on the properties window change it from /Hive=8.0 /Configuration="[TARGETDIR]xxx.xml" to /Hive=9.0 /Configuration="[TARGETDIR]xxx.xml"              &lt;br /&gt;
            &lt;br /&gt;
            &lt;/li&gt;
            &lt;li&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image15.png"&gt;&lt;img height="436" border="0" width="846" title="image" style="border: 0px none ; display: inline;" alt="image" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image15_thumb.png" /&gt;&lt;/a&gt;               &lt;br /&gt;
            &lt;br /&gt;
            &lt;/li&gt;
        &lt;/ol&gt;
        &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/li&gt;
    &lt;li&gt;Again with the project XXXSetup2008 selected
    &lt;ol&gt;
        &lt;li&gt;In the solution explorer choose “Launch Conditions Editor” icon &lt;/li&gt;
        &lt;li&gt;A window will open with the following Launch Conditions:
        &lt;ol&gt;
            &lt;li&gt;Search Target Machine &lt;/li&gt;
            &lt;li&gt;Launch Conditions &lt;/li&gt;
        &lt;/ol&gt;
        &lt;/li&gt;
        &lt;li&gt;click in every single option (CSharp, RunTime, VS, .NetFramework, C# Language, Guidance Automation Extensions, VS.Net) and in the properties you will have to change every single place you have 8 (VS2005) change it to 9 (VS2008).          &lt;br /&gt;
        &lt;br /&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image20.png"&gt;&lt;img height="451" border="0" width="876" title="image" style="border: 0px none ; display: inline;" alt="image" src="http://agilior.pt/blogs/images/agilior_pt/blogs/pedro.rainho/WindowsLiveWriter/SoftwareFactoryGuidanceMigrationfromVisu_F4DB/image20_thumb.png" /&gt;&lt;/a&gt;  &lt;br /&gt;
        &lt;br /&gt;
        &lt;/li&gt;
        &lt;li&gt;Here it is what you need to change:
        &lt;ol&gt;
            &lt;li&gt;In CSharp change it from:              &lt;br /&gt;
              SOFTWARE\Microsoft\VisualStudio\8.0\InstalledProducts\Microsoft Visual C#               &lt;br /&gt;
            To:               &lt;br /&gt;
              SOFTWARE\Microsoft\VisualStudio\9.0\InstalledProducts\Microsoft Visual C# &lt;/li&gt;
            &lt;li&gt;In RunTime change it from:              &lt;br /&gt;
              SOFTWARE\Microsoft\VisualStudio\8.0\InstalledProducts\RecipeManagerPackage               &lt;br /&gt;
            To:               &lt;br /&gt;
              SOFTWARE\Microsoft\VisualStudio\9.0\InstalledProducts\RecipeManagerPackage &lt;/li&gt;
            &lt;li&gt;In VS.Net change it from:              &lt;br /&gt;
              SOFTWARE\Microsoft\VisualStudio\8.0\Setup\VS               &lt;br /&gt;
            To:               &lt;br /&gt;
              SOFTWARE\Microsoft\VisualStudio\9.0\Setup\VS &lt;/li&gt;
            &lt;li&gt;In VS.Net change it from::              &lt;br /&gt;
              Visual Studio .NET 8.0 is not installed. Do you want to see information of the product? Click Yes to be directed to a web page, click No to exit.               &lt;br /&gt;
            To:               &lt;br /&gt;
              Visual Studio .NET 9.0 is not installed. Do you want to see information of the product? Click Yes to be directed to a web page, click No to exit. &lt;/li&gt;
        &lt;/ol&gt;
        &lt;/li&gt;
    &lt;/ol&gt;
    &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Now Compile and create the MSI’s. The next step is test the Factory in a VS 2008 :) Hope I was able to help. Sure helped me.&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/6880.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/06/6880.aspx</guid>
            <pubDate>Fri, 06 Feb 2009 09:28:32 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/6880.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/06/6880.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/6880.aspx</wfw:commentRss>
        </item>
        <item>
            <title>How to get all projects that exists in a Visual Studio Solution</title>
            <link>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/05/6872.aspx</link>
            <description>&lt;p&gt;Recently during a software factory development I had a problem, how can I get all projects that exists in a visual studio solution. &lt;/p&gt;
&lt;p&gt;The only solution that I found was this:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color: blue;"&gt;public static &lt;/span&gt;Project[] GetAllSolutionProjects(Solution solution)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;if &lt;/span&gt;(solution == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue;"&gt;return null&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;Project&amp;gt; solutionProjects = &lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;Project&amp;gt;();&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;foreach &lt;/span&gt;(Project project &lt;span style="color: blue;"&gt;in &lt;/span&gt;solution.Projects)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue;"&gt;if &lt;/span&gt;(project.Object &lt;span style="color: blue;"&gt;is &lt;/span&gt;Project)&lt;br /&gt;        {&lt;br /&gt;            solutionProjects.Add(project.Object &lt;span style="color: blue;"&gt;as &lt;/span&gt;Project);&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: blue;"&gt;else&lt;br /&gt;        &lt;/span&gt;{&lt;br /&gt;            Project[] projects = GetAllVsProjects(project.ProjectItems);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue;"&gt;if &lt;/span&gt;(projects != &lt;span style="color: blue;"&gt;null &lt;/span&gt;&amp;amp;&amp;amp; projects.Length &amp;gt; 0)&lt;br /&gt;            {&lt;br /&gt;                solutionProjects.AddRange(projects);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;solutionProjects.ToArray();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;private static &lt;/span&gt;Project[] GetAllVsProjects(ProjectItems items)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;if &lt;/span&gt;(items == &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue;"&gt;return null&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;Project&amp;gt; solutionProjects = &lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&amp;lt;Project&amp;gt;();&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;foreach &lt;/span&gt;(ProjectItem item &lt;span style="color: blue;"&gt;in &lt;/span&gt;items)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue;"&gt;if &lt;/span&gt;(IsProject(item.Kind))&lt;br /&gt;        {&lt;br /&gt;            solutionProjects.Add(item.Object &lt;span style="color: blue;"&gt;as &lt;/span&gt;Project);&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: blue;"&gt;else if &lt;/span&gt;(item.SubProject != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue;"&gt;if &lt;/span&gt;(IsProject(item.SubProject.Kind))&lt;br /&gt;            {&lt;br /&gt;                solutionProjects.Add(item.SubProject &lt;span style="color: blue;"&gt;as &lt;/span&gt;Project);&lt;br /&gt;            }&lt;br /&gt;            &lt;span style="color: blue;"&gt;else&lt;br /&gt;            &lt;/span&gt;{&lt;br /&gt;                Project[] subprojects = GetAllVsProjects(item.SubProject.ProjectItems);&lt;br /&gt;&lt;br /&gt;                &lt;span style="color: blue;"&gt;if &lt;/span&gt;(subprojects != &lt;span style="color: blue;"&gt;null &lt;/span&gt;&amp;amp;&amp;amp; subprojects.Length &amp;gt; 0)&lt;br /&gt;                {&lt;br /&gt;                    solutionProjects.AddRange(subprojects);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;span style="color: blue;"&gt;else&lt;br /&gt;        &lt;/span&gt;{&lt;br /&gt;            Project[] projects = GetAllVsProjects(item.ProjectItems);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue;"&gt;if &lt;/span&gt;(projects != &lt;span style="color: blue;"&gt;null &lt;/span&gt;&amp;amp;&amp;amp; projects.Length &amp;gt; 0)&lt;br /&gt;            {&lt;br /&gt;                solutionProjects.AddRange(projects);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;solutionProjects.ToArray();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;public static bool &lt;/span&gt;IsProject(&lt;span style="color: rgb(43, 145, 175);"&gt;Guid &lt;/span&gt;projectKind)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: green;"&gt;//Visual Basic {F184B08F-C81C-45F6-A57F-5ABD9991F28F}&lt;br /&gt;    //Visual C# {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}&lt;br /&gt;    //Visual C++ {8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}&lt;br /&gt;    //Visual J# {E6FDF86B-F3D1-11D4-8576-0002A516ECE8}&lt;br /&gt;    //Web Project {E24C65DC-7377-472b-9ABA-BC803B73C61A}&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;return &lt;/span&gt;IsWebProject(projectKind) || &lt;br /&gt;        IsVisualJSharpProject(projectKind) || &lt;br /&gt;        IsVisualCPlusPlusProject(projectKind) ||&lt;br /&gt;        IsVisualCSharpProject(projectKind) ||&lt;br /&gt;        IsVisualBasicProject(projectKind);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;public static bool &lt;/span&gt;IsProject(&lt;span style="color: blue;"&gt;string &lt;/span&gt;projectKind)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;if&lt;/span&gt;(&lt;span style="color: blue;"&gt;string&lt;/span&gt;.IsNullOrEmpty(projectKind))&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: blue;"&gt;return false&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;IsProject(&lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt;(projectKind));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;public static bool &lt;/span&gt;IsWebProject(&lt;span style="color: rgb(43, 145, 175);"&gt;Guid &lt;/span&gt;projectKind)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;projectKind.CompareTo(&lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"{E24C65DC-7377-472b-9ABA-BC803B73C61A}"&lt;/span&gt;)) == 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;public static bool &lt;/span&gt;IsVisualJSharpProject(&lt;span style="color: rgb(43, 145, 175);"&gt;Guid &lt;/span&gt;projectKind)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;projectKind.CompareTo(&lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"{E6FDF86B-F3D1-11D4-8576-0002A516ECE8}"&lt;/span&gt;)) == 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;public static bool &lt;/span&gt;IsVisualCPlusPlusProject(&lt;span style="color: rgb(43, 145, 175);"&gt;Guid &lt;/span&gt;projectKind)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;projectKind.CompareTo(&lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"&lt;/span&gt;)) == 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;public static bool &lt;/span&gt;IsVisualCSharpProject(&lt;span style="color: rgb(43, 145, 175);"&gt;Guid &lt;/span&gt;projectKind)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;projectKind.CompareTo(&lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"&lt;/span&gt;)) == 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;public static bool &lt;/span&gt;IsVisualBasicProject(&lt;span style="color: rgb(43, 145, 175);"&gt;Guid &lt;/span&gt;projectKind)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue;"&gt;return &lt;/span&gt;projectKind.CompareTo(&lt;span style="color: blue;"&gt;new &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt;(&lt;span style="color: rgb(163, 21, 21);"&gt;"{F184B08F-C81C-45F6-A57F-5ABD9991F28F}"&lt;/span&gt;)) == 0;&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Can any one tell me if is there a simple solution to get all projects in a VS solution, because this seems to me too much code just to get all projects. Is there another way???&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The projects I want are: Visual Basic, Visual C#, Visual C++, Visual J# and Web Project. I was only able to do this watching to the project kind property. &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Is there another way???&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/pedro.rainho/aggbug/6872.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pedro Rainho</dc:creator>
            <guid>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/05/6872.aspx</guid>
            <pubDate>Thu, 05 Feb 2009 12:36:40 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/pedro.rainho/comments/6872.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/pedro.rainho/archive/2009/02/05/6872.aspx#feedback</comments>
            <slash:comments>18</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/pedro.rainho/comments/commentRss/6872.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
