Procházet zdrojové kódy

All these files want to be committed. All white space junk. grr.

Diva Canto před 14 roky
rodič
revize
d5c7a8d28c
27 změnil soubory, kde provedl 5611 přidání a 5611 odebrání
  1. 65 65
      Prebuild/COPYING
  2. 200 200
      Prebuild/NEWS
  3. 274 274
      Prebuild/README
  4. 4 4
      Prebuild/scripts/.svn/text-base/SharpDevelop2.bat.svn-base
  5. 4 4
      Prebuild/scripts/.svn/text-base/VS2008.bat.svn-base
  6. 4 4
      Prebuild/scripts/.svn/text-base/VS2010.bat.svn-base
  7. 4 4
      Prebuild/scripts/.svn/text-base/autotools.bat.svn-base
  8. 4 4
      Prebuild/scripts/SharpDevelop2.bat
  9. 4 4
      Prebuild/scripts/VS2008.bat
  10. 4 4
      Prebuild/scripts/VS2010.bat
  11. 4 4
      Prebuild/scripts/autotools.bat
  12. 79 79
      Prebuild/src/Core/Nodes/.svn/text-base/CleanFilesNode.cs.svn-base
  13. 84 84
      Prebuild/src/Core/Nodes/.svn/text-base/CleanupNode.cs.svn-base
  14. 71 71
      Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNodeCollection.cs.svn-base
  15. 93 93
      Prebuild/src/Core/Nodes/.svn/text-base/DatabaseProjectNode.cs.svn-base
  16. 63 63
      Prebuild/src/Core/Nodes/.svn/text-base/DatabaseReferenceNode.cs.svn-base
  17. 79 79
      Prebuild/src/Core/Nodes/CleanFilesNode.cs
  18. 84 84
      Prebuild/src/Core/Nodes/CleanupNode.cs
  19. 71 71
      Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs
  20. 93 93
      Prebuild/src/Core/Nodes/DatabaseProjectNode.cs
  21. 63 63
      Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs
  22. 1070 1070
      Prebuild/src/Core/Targets/.svn/text-base/AutotoolsTarget.cs.svn-base
  23. 138 138
      Prebuild/src/Core/Targets/.svn/text-base/VS2010Target.cs.svn-base
  24. 922 922
      Prebuild/src/Core/Targets/.svn/text-base/VSGenericTarget.cs.svn-base
  25. 1070 1070
      Prebuild/src/Core/Targets/AutotoolsTarget.cs
  26. 138 138
      Prebuild/src/Core/Targets/VS2010Target.cs
  27. 922 922
      Prebuild/src/Core/Targets/VSGenericTarget.cs

+ 65 - 65
Prebuild/COPYING

@@ -1,65 +1,65 @@
-BSD License
-Copyright (c)2004-2008
-
-See AUTHORS file for list of copyright holders
-
-Dave    Hudson        ([email protected]),
-Matthew Holmes        ([email protected])
-Dan     Moorehead     ([email protected])
-Rob     Loach         (http://www.robloach.net)
-C.J.    Adams-Collier ([email protected])
-
-http://dnpb.sourceforge.net
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright notice,
-   this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution.
-
-3. The names of the authors may not be used to endorse or promote
-   products derived from this software without specific prior written
-   permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-   COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-   POSSIBILITY OF SUCH DAMAGE.
-
----
-
-Portions of src/Core/Targets/AutotoolsTarget.cs
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-// 
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-// 
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+BSD License
+Copyright (c)2004-2008
+
+See AUTHORS file for list of copyright holders
+
+Dave    Hudson        ([email protected]),
+Matthew Holmes        ([email protected])
+Dan     Moorehead     ([email protected])
+Rob     Loach         (http://www.robloach.net)
+C.J.    Adams-Collier ([email protected])
+
+http://dnpb.sourceforge.net
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+3. The names of the authors may not be used to endorse or promote
+   products derived from this software without specific prior written
+   permission.
+
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+   COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+   POSSIBILITY OF SUCH DAMAGE.
+
+---
+
+Portions of src/Core/Targets/AutotoolsTarget.cs
+// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 200 - 200
Prebuild/NEWS

@@ -1,200 +1,200 @@
-Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt.
-
-Documentation and downloads are available at http://dnpb.sourceforge.net.
-
-Prebuild is licensed under the BSD license.
-
-[ XXXXXXX XX, XXX - 1.3.2 ]
-	+ Added Keyfile signing to NAnt target and VS2005 target
-	+ Updated XSD file to 1.7
-	+ Boo and VisualBasic Language support in VS2005 target
-	+ Added basic Autotools target. It creates a non-recursive Autotools system. 
-	! Multiple files can be excluded from the Match node	
-	! VS2005 now handles .resx files correctly.
-	! NAnt and Autotools now handle defines
-	! NAnt and Autotools now handle resources
-	+ Conditional XML variables can be passed through the command line.
-	+ Added /install and /remove command line flags to install and remove assemblies from the GAC
-	+ Many fixes to VS2005 target
-
-[ July 21, 2006 - 1.3.1 ]
-	! VS2005 fixes from Rob Loach
-	! NAnt fixes from Rob Loach and David Hudson
-	! XML doc fixes from Rob Loach
-	+ Added SharpDevelop2 target (really just uses VS2005 target)
-	! Fixed bug with BuildEvents in Monodevelop target
-	+ Passing /yes will default to answering yes to any warnings
-
-[ February 28, 2006 - 1.3 ]
-	+ Added MonoDevelop target.
-	+ Added NAnt target.
-	+ Lots of fixes to all targets.
-	* Cleaned up the code using FXCop.
-	* Updated schema to 1.6 to fix a typo and add a new parameter.
-	* jendave is now the maintainer of the project. RobLoach has been added as a developer.
-	* Removed references to 'dnpb'.
-	+ Added rudimentary support for pre- and post- build scripts
-	* Updated examples.
-
-[ August 5, 2004 - 1.2 ]
-	+ Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages
-	+ Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags
-	+ Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs
-	* Modified the removedir command line option to allow for a pipe-delimited list of directory names
-	! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well
-	+ Added the GenerateXmlDocFile boolean option to the Options XML element
-	* Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this
-
-[ January 3, 2004 - 1.1 ]
-	! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems
-	+ Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake
-	* Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version
-
-[ December 30, 2004 - 1.1 ]
-    ! Applied Leed's fix for SharpDevelop references
-    + Rewrote much of the processing for better validation and without the use of a temp file
-    + Added support for configurations at the project level which are named All.  They now apply changes to all Solution level defined configs
-	* Changed all spaces into tabs
-	+ Added support for the None build action
-	* Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument
-	
-[ December 25, 2004 - 1.0 ]
-    + Added the /removedir option for cleaning directories like obj before file releases
-    + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds
-    * Made path optional for Match elements (defaults to current directory) and updates schema for it
-    ! Fixed XML example in the readme.txt
-    + Added example xml files to docs directory
-    * Updated license.txt to add Dan Moorehead and update copyright years
-    + Updated prebuild.xml to take advantage of the default path attribute for match elements
-    + Updated Clean to delete the obj directories
-
-[ December 25, 2004 - 0.13 ]
-    + Added dnpb.exe so that it can be used to generate the project files
-    + Added dnpb.ico
-    * Added parameterless Write statement to Log for writing a single line
-    * Changed scehema to version 1.3 for support of icon attribute
-    * Added support for All configuration name under a Project node signifying common settings for all configurations
-    ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode
-    * Wrote documentation in docs/readme.txt
-    * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005
-    * Updated prebuild.xml
-    * Optimized Log class
-    * Updated OutputUsage()
-    * /clean targets all by default
-    * No log file is used by default, /log without value specified uses default file name
-    + Added support for the /pause which pauses the utility after execution to observe output
-
-
-[ September 27, 2004 - 0.12.2a ]
-    ! Fixed a nasty bug when trying to delete our temp file for pre-processing.
-
-[ September 15, 2004 - 0.12.2 ]
-    + Expanded platform identification, thanks to the NAnt guys for shedding some
-      light on how to properly check for UNIX platforms! Thanks guys!
-    * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX",
-      and "Unknown".
-    ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of
-      the Project tag.
-    + New command-line switch, /ppo, forces DNPB to pre-process the file and write
-      the pre-processed file. This allows you to test/debug your pre-processor
-      macros. No other processing will be done. You can specify a target file as
-      a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml'
-      if you do not specify a file.
-    + The Match tag now has a 'buildAction' attribute which functions exactly like
-      the attribute of the same name for the File tag.
-
-[ August 5, 2004 - 0.12.1 ]
-    + Added environment variable expansion for all values. Environment variables
-      should be listed in the form ${VAR}.
-
-[ July 30, 2004 - 0.12.0 ]
-    + Added preprocessing via XML processing information tags. Available tags
-      are: <?if <exp> ?>, <?elseif <exp> ?>, <?else ?> and <?endif ?>. The
-      current expression parser is very basic, but will be replaced with a more
-      capable parser over time. Current operators available are: =, !=, <, >,
-      <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor,
-      RuntimeMinor, RuntimeRevision.
-
-[ July 27, 2004 - 0.11.4 ]
-    + Added 'useRegex' attribute to the Match tag. Matches can now use regular
-      expressions to match filenames.
-    + Added the 'assemblyName' attribute to the Project tag. Projects can now
-      set their output assembly name.
-    ! Fixed several bugs in the way that Project tags inheirt their parent
-      Solutions configuration options. This operation should now work fully as
-      intended.
-    ! Due to some wierdness, Project Guid's are now stored as part of the Project
-      node and created at parse time.
-
-[ May 11, 2004 - 0.11.3 ]
-    ! Fixed a bug where I was writing the wrong property name for a projects root
-      namespace.
-    ! Removed a DEBUG statement I had left in the code in 0.11.2.
-    ! Fixed a bug in the VS2002 writer which caused the version variables to not
-      be overriden correctly.
-    + Added the rootNamespace property to the <Project> element, allowing you to
-      specify the root namespace.
-    * /target and /clean are now mutually exclusive command line switches, and
-      they both now take the all option. In the case of /target all, all build
-      file for all targets will be created. In the case of /clean all, the user
-      will be prompted to make sure they want to do it, and if so, will clean
-      all build files for all targets.
-
-[ April 22, 2004 - 0.11.2 ]
-    ! Fixed a bug with the /file command-line operator. Was using the unresolved
-      file path rather then the resolved one, was making the attempt to open the
-      dnpb file fail.
-    ! Fixed a bug in the schema that required at least 1 solution and 1 reference
-      path. We can do just fine with 0 of either of these. Some files may be all
-      <Process> statements and not have any <Solution> tags.
-    ! Fixed a bug that caused the project references not to be written with the
-      SharpDevelop target.
-    * Changed the schema to version 1.2, allowing for Configuration nodes to exist
-      under project nodes. The inheritance of values is hierarchical. Meaning, if
-      you define a configuration named Debug at the Soltion level, and one by the
-      same name at the Project level, the one at the Project level will first
-      inherit the options of the Solution level configuration, then set it's own
-      options. If you define a configuration at the Project level and it does not
-      exist at the Solution level, it will be created at the Solution level.
-    * Project references should now work correctly across the board. Note that due
-      to a restriction in Visual Studio, you can only reference projects in the same
-      solution.
-
-[ April 21, 2004 - 0.11.1 ]
-    ! Fixed a problem with resolving paths in various targets. Was not properly
-      setting the CWD.
-    * Schema updated to 1.1, moving the ReferencePath element from the Options
-      element to the Project element. This makes more logical sense, given that
-      reference paths are resolved relative to the project path. Any prebuild.xml
-      file referecning verison 1.0 will fail! Please update to the 1.1 schema.
-
-[ April 19, 2004 - 0.11.0 ]
-    * Added several attributes across the code to make FxCop happy
-    ! Fixed bugs in reference paths being written in the VS targets.
-    ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of
-      a Push/Pop pair. Was wreaking havoc with <Process> tags.	
-    ! Fixed some bugs in the path tracking, both the Project and Solution nodes now
-      have a FullPath property, which is the full path to the file resolved at load
-      time. This should fix all path relativity problems.
-    + Added new /clean switch, allowing the target to clean up any files it generated.
-      in accordance, the ITarget interface has been updated to support a new Clean()
-      method.
-    + Completed addition of the <Process> tag, to allow the referencing of external
-      prebuild.xml files.
-    + Added the runtime attribute to the Project element. This allows the developer
-      to specify which runtime a project should target (Mono or Microsoft). This is
-      of course ignored in certain targets like the Visual Studio targets.
-    + Added the SharpDevelop target.
-
-[ April 13, 2004 - 0.10.1a ]
-    + Added the buildAction attribute to the File node. This is needed for dnpb
-    to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource)
-
-[ April 13, 2004 - 0.10.1 ]
-    * First Release
-
-[ Key ]
-* = Change or information
-+ = Addition
-! = Bug Fix
-
+Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, MonoDevelop, and NAnt.
+
+Documentation and downloads are available at http://dnpb.sourceforge.net.
+
+Prebuild is licensed under the BSD license.
+
+[ XXXXXXX XX, XXX - 1.3.2 ]
+	+ Added Keyfile signing to NAnt target and VS2005 target
+	+ Updated XSD file to 1.7
+	+ Boo and VisualBasic Language support in VS2005 target
+	+ Added basic Autotools target. It creates a non-recursive Autotools system. 
+	! Multiple files can be excluded from the Match node	
+	! VS2005 now handles .resx files correctly.
+	! NAnt and Autotools now handle defines
+	! NAnt and Autotools now handle resources
+	+ Conditional XML variables can be passed through the command line.
+	+ Added /install and /remove command line flags to install and remove assemblies from the GAC
+	+ Many fixes to VS2005 target
+
+[ July 21, 2006 - 1.3.1 ]
+	! VS2005 fixes from Rob Loach
+	! NAnt fixes from Rob Loach and David Hudson
+	! XML doc fixes from Rob Loach
+	+ Added SharpDevelop2 target (really just uses VS2005 target)
+	! Fixed bug with BuildEvents in Monodevelop target
+	+ Passing /yes will default to answering yes to any warnings
+
+[ February 28, 2006 - 1.3 ]
+	+ Added MonoDevelop target.
+	+ Added NAnt target.
+	+ Lots of fixes to all targets.
+	* Cleaned up the code using FXCop.
+	* Updated schema to 1.6 to fix a typo and add a new parameter.
+	* jendave is now the maintainer of the project. RobLoach has been added as a developer.
+	* Removed references to 'dnpb'.
+	+ Added rudimentary support for pre- and post- build scripts
+	* Updated examples.
+
+[ August 5, 2004 - 1.2 ]
+	+ Added Visual Studio Express (vs2005express) target contributed by Borrillis and modified for use with different languages
+	+ Added the allowedgroups command line option followed by a pipe-delimited list of project group filter flags (eg. Group1|Group2) allow optional filtering of all projects that dont have at least one of these flags
+	+ Added the filterGroups XML attribute to the project node and updated the scheme to v1.5 for this addition, it is used to specified the delimited list of filter groups to which a project belongs
+	* Modified the removedir command line option to allow for a pipe-delimited list of directory names
+	! Modified the resource loading code to search for resourced without the prepended namespace (as Visual Studio .NET does it) to allow for it to be compiled with SharpDevelop as well
+	+ Added the GenerateXmlDocFile boolean option to the Options XML element
+	* Changed the behavior of the XmlDocFile option so that if not specified it uses the assemblyName (without file extension) + .xml for the file name instead of just not generating the file since the new GenerateXmlDocFile takes care of this
+
+[ January 3, 2004 - 1.1 ]
+	! Replaced regex use for more efficient manual parsing to allow use on non-windows platforms with Mono which has Regex problems
+	+ Added the checkOsVars attribute to the root element for enabling interpolation for Enviroment variables in the form ${var}, otherwise no checking is performed for efficiency-sake
+	* Make the version attribute on the root element optional as it isn't used and not needed since the schema url contains the version
+
+[ December 30, 2004 - 1.1 ]
+    ! Applied Leed's fix for SharpDevelop references
+    + Rewrote much of the processing for better validation and without the use of a temp file
+    + Added support for configurations at the project level which are named All.  They now apply changes to all Solution level defined configs
+	* Changed all spaces into tabs
+	+ Added support for the None build action
+	* Replaced all sequence's in the XML schema for all's because the order doesn't matter since the xml file is loaded into an XmlDocument
+	
+[ December 25, 2004 - 1.0 ]
+    + Added the /removedir option for cleaning directories like obj before file releases
+    + Changed WriteTempXml() and the new DeleteTempXml() methods to be compiled only in DEBUG builds
+    * Made path optional for Match elements (defaults to current directory) and updates schema for it
+    ! Fixed XML example in the readme.txt
+    + Added example xml files to docs directory
+    * Updated license.txt to add Dan Moorehead and update copyright years
+    + Updated prebuild.xml to take advantage of the default path attribute for match elements
+    + Updated Clean to delete the obj directories
+
+[ December 25, 2004 - 0.13 ]
+    + Added dnpb.exe so that it can be used to generate the project files
+    + Added dnpb.ico
+    * Added parameterless Write statement to Log for writing a single line
+    * Changed scehema to version 1.3 for support of icon attribute
+    * Added support for All configuration name under a Project node signifying common settings for all configurations
+    ! Fixed the SupressWarnings by adding the corresponding field to OptionsNode
+    * Wrote documentation in docs/readme.txt
+    * Added Dan Moorehead to copyrights and extended date from 2004 to 2004-2005
+    * Updated prebuild.xml
+    * Optimized Log class
+    * Updated OutputUsage()
+    * /clean targets all by default
+    * No log file is used by default, /log without value specified uses default file name
+    + Added support for the /pause which pauses the utility after execution to observe output
+
+
+[ September 27, 2004 - 0.12.2a ]
+    ! Fixed a nasty bug when trying to delete our temp file for pre-processing.
+
+[ September 15, 2004 - 0.12.2 ]
+    + Expanded platform identification, thanks to the NAnt guys for shedding some
+      light on how to properly check for UNIX platforms! Thanks guys!
+    * POSIX OS identifier changed to UNIX. Valid OS names are now "Win32", "UNIX",
+      and "Unknown".
+    ! Fixed SharpDevelop target to properly use the 'rootNamespace' attribute of
+      the Project tag.
+    + New command-line switch, /ppo, forces DNPB to pre-process the file and write
+      the pre-processed file. This allows you to test/debug your pre-processor
+      macros. No other processing will be done. You can specify a target file as
+      a paramter for the /ppo switch, or DNPB will write the file 'preprocessed.xml'
+      if you do not specify a file.
+    + The Match tag now has a 'buildAction' attribute which functions exactly like
+      the attribute of the same name for the File tag.
+
+[ August 5, 2004 - 0.12.1 ]
+    + Added environment variable expansion for all values. Environment variables
+      should be listed in the form ${VAR}.
+
+[ July 30, 2004 - 0.12.0 ]
+    + Added preprocessing via XML processing information tags. Available tags
+      are: <?if <exp> ?>, <?elseif <exp> ?>, <?else ?> and <?endif ?>. The
+      current expression parser is very basic, but will be replaced with a more
+      capable parser over time. Current operators available are: =, !=, <, >,
+      <=, >=. Current test variables available: OS, RuntimeVersion, RuntimeMajor,
+      RuntimeMinor, RuntimeRevision.
+
+[ July 27, 2004 - 0.11.4 ]
+    + Added 'useRegex' attribute to the Match tag. Matches can now use regular
+      expressions to match filenames.
+    + Added the 'assemblyName' attribute to the Project tag. Projects can now
+      set their output assembly name.
+    ! Fixed several bugs in the way that Project tags inheirt their parent
+      Solutions configuration options. This operation should now work fully as
+      intended.
+    ! Due to some wierdness, Project Guid's are now stored as part of the Project
+      node and created at parse time.
+
+[ May 11, 2004 - 0.11.3 ]
+    ! Fixed a bug where I was writing the wrong property name for a projects root
+      namespace.
+    ! Removed a DEBUG statement I had left in the code in 0.11.2.
+    ! Fixed a bug in the VS2002 writer which caused the version variables to not
+      be overriden correctly.
+    + Added the rootNamespace property to the <Project> element, allowing you to
+      specify the root namespace.
+    * /target and /clean are now mutually exclusive command line switches, and
+      they both now take the all option. In the case of /target all, all build
+      file for all targets will be created. In the case of /clean all, the user
+      will be prompted to make sure they want to do it, and if so, will clean
+      all build files for all targets.
+
+[ April 22, 2004 - 0.11.2 ]
+    ! Fixed a bug with the /file command-line operator. Was using the unresolved
+      file path rather then the resolved one, was making the attempt to open the
+      dnpb file fail.
+    ! Fixed a bug in the schema that required at least 1 solution and 1 reference
+      path. We can do just fine with 0 of either of these. Some files may be all
+      <Process> statements and not have any <Solution> tags.
+    ! Fixed a bug that caused the project references not to be written with the
+      SharpDevelop target.
+    * Changed the schema to version 1.2, allowing for Configuration nodes to exist
+      under project nodes. The inheritance of values is hierarchical. Meaning, if
+      you define a configuration named Debug at the Soltion level, and one by the
+      same name at the Project level, the one at the Project level will first
+      inherit the options of the Solution level configuration, then set it's own
+      options. If you define a configuration at the Project level and it does not
+      exist at the Solution level, it will be created at the Solution level.
+    * Project references should now work correctly across the board. Note that due
+      to a restriction in Visual Studio, you can only reference projects in the same
+      solution.
+
+[ April 21, 2004 - 0.11.1 ]
+    ! Fixed a problem with resolving paths in various targets. Was not properly
+      setting the CWD.
+    * Schema updated to 1.1, moving the ReferencePath element from the Options
+      element to the Project element. This makes more logical sense, given that
+      reference paths are resolved relative to the project path. Any prebuild.xml
+      file referecning verison 1.0 will fail! Please update to the 1.1 schema.
+
+[ April 19, 2004 - 0.11.0 ]
+    * Added several attributes across the code to make FxCop happy
+    ! Fixed bugs in reference paths being written in the VS targets.
+    ! Fixed a bug in ProjectNode which was doing two CWDStack.Push() calls instead of
+      a Push/Pop pair. Was wreaking havoc with <Process> tags.	
+    ! Fixed some bugs in the path tracking, both the Project and Solution nodes now
+      have a FullPath property, which is the full path to the file resolved at load
+      time. This should fix all path relativity problems.
+    + Added new /clean switch, allowing the target to clean up any files it generated.
+      in accordance, the ITarget interface has been updated to support a new Clean()
+      method.
+    + Completed addition of the <Process> tag, to allow the referencing of external
+      prebuild.xml files.
+    + Added the runtime attribute to the Project element. This allows the developer
+      to specify which runtime a project should target (Mono or Microsoft). This is
+      of course ignored in certain targets like the Visual Studio targets.
+    + Added the SharpDevelop target.
+
+[ April 13, 2004 - 0.10.1a ]
+    + Added the buildAction attribute to the File node. This is needed for dnpb
+    to even be able to bootstrap itself (dnpb-1.0.xsd must be an embedded resource)
+
+[ April 13, 2004 - 0.10.1 ]
+    * First Release
+
+[ Key ]
+* = Change or information
++ = Addition
+! = Bug Fix
+

+ 274 - 274
Prebuild/README

@@ -1,274 +1,274 @@
-Prebuild Instructions
-
-Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt.
-
-_______________________________________________________________________________
-Overview
-
-Prebuild can be either be run from the command line to generate the
-project and make files or you can execute the included batch (*.bat)
-and Unix Shell script (*.sh) files.
-
-_______________________________________________________________________________
-The currently supported developement tools and their associated batch
-and shell script files.
-
-Visual Studio .NET 2005 (VS2005.bat)
-Visual Studio .NET 2003 (VS2003.bat)
-Visual Studio .NET 2002 (VS2002.bat)
-SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
-SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
-MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/
-NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/
-Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system
-
-Notes:
-
-A Unix Shell script is provided for MonoDevelop, as it does not run on
-Windows at this time.
-
-Visual Studio .NET 2005 and the Visual Express IDE's can import
-solutions from older versions of Visual Studio .NET.
-
-Makefiles are not currently supported.
-
-_______________________________________________________________________________
-Command Line Syntax:
- 
-Example:
-> Prebuild /target vs2003
-
-This will generate the project files for Visual Studio.NET 2003 and
-place the redirect the log to a file named PrebuildLog.txt in the
-parent directory
-
-
-The syntax structure is as below, where commandParameter is optional
-depending on the command and you can provide several option-value
-pairs.
-
-Note: The '> ' signifies the command prompt, do not enter this literally
-
-> Prebuild /<option> <commandParameter>
-
-> Prebuild /target vs2003 /pause
-
-> Prebuild /target vs2003 /log ../Log.txt /pause /ppo /file ProjectConfig.xml
-
-> Prebuild /target sharpdev /log
-
-> Prebuild /removedir obj|bin
-
-> Prebuild /target vs2003 /allowedgroups Group1|Group2
-
-> Prebuild /clean
-
-> Prebuild /clean /yes
-
-> Prebuild /clean vs2003
-
-_______________________________________________________________________________
-Command Line Options:
-
-/usage - Shows the help information on how to use Prebuild and what
-the different options are and what they do
-
-/clean - The project files generated for the target type specified as
-a parameter for this option will be deleted.  If no value is specified
-or if 'all' is specified, then project files for all the target types
-will be deleted.
-
-/target - Specified the name of the development tool for which project
-or make files will be generated.  Possible parameter values include:
-vs2003, vs2002, sharpdev
-
-/file - Specifies the name of the XML which defines what files are to
-be referenced by the generated project files as well as configures the
-options for them.  If not specified, prebuild.xml in the current
-directory will be used as the default.
-
-/log - Specified the log file that should be written to for build
-errors.  If this option is not specified, no log file is generated,
-but if just no value is specified, then the defaul filename will be
-used for the log (Prebuild.log).
-
-/ppo - Preprocesses the xml file to test for syntax errors or problems
-but doesn't generate the files
-
-/pause - Shows the console until you press a key so that you can view
-the messages written while performing the specified actions.
-
-This allows you to check if an errors occurred and - if so - what it
-was.
-
-/showtargets - Shows a list of all the targets that can be specified
-as values for the /clean and /target commands.
-
-/allowedgroups - This is followed by a pipe-delimited list of project
-group filter flags (eg. Group1|Group2) allow optional filtering of all
-projects that dont have at least one of these flags
-
-/removedir - This is followed by a pipe-delimited list of directory
-names that will be deleted while recursivly searching the directory of
-the prebuild application and its child directories (eg. use obj|bin to
-delete all output and temporary directories before file releases)
-
-/yes - Answer yes to any warnings (e.g. when cleaning all projects).
-
-_______________________________________________________________________________
-Example Batch Files and Shell Scripts
-
-NOTE: Common batch and shell script files are included with Prebuild source and file releases.
-______________________________
-MonoDevelop
-
-#!/bin/sh
-# Generates a solution (.mds) and a set of project files (.mdp) 
-
-# for MonoDevelop, a Mono port of SharpDevelop
-#  (http://icsharpcode.net/OpenSource/SD/Default.aspx)
-
-./Prebuild /target monodev /pause
-
-______________________________
-Visual Studio .NET 2003
-
-@rem Generates a solution (.sln) and a set of project files (.csproj) 
-@rem for Microsoft Visual Studio .NET 2002
-Prebuild /target vs2003 /pause
-
-Notes:
-Text after lines that start with @rem are comments and are not evaluated
-You can also place pause on the last line instead of specifing the /pause command.
-
-_______________________________________________________________________________
-Example XML Configuration File
-
-Note:
-
-XML Comments (<!-- Comment -->) are used to markup the prebuild.xml
-file with notes
-
-The below file may be out-of-date, however the RealmForge Prebuild
-file serves as an up-to-date and extensive example.
-
-It can be viewed using Tigris.org's WebSVN
-(http://realmforge.tigris.org/source/browse/realmforge/trunk/src/prebuild.xml)
-by just clicking on the "view file" link for the latest revision.
-
-_________________________________
-
-<?xml version="1.0" encoding="utf-8"?>
-    <!--The version of the XML schema specified in the version and xmlns attributes should match the one for which the version of Prebuild.exe used was compiled for.  In this example it is the version 1.3 schema, you can find the XSD schema file at the url specified in the xmlns attribute. -->
-<Prebuild version="1.6" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
-	<Solution name="RealmForge"> <!--The title and file name for the solution, combine, workspace, or project group (depending on what development tool you are using)-->
-                       <!--Configurations found as children of Solution are used as templates for the configurations found in the project, this allows you to avoid writing the same options in each project (and maintaining each of these).  You can provide defaults and then override them in the configurations defined for each project. All options are optional.-->
-		<Configuration name="Debug">
-			<Options>
-				<!-- simple logically expressions can be evaluated, if, else, elseif, and endif are valid statements.  Note that it is not neccisary to define POSIX or WIN32 -->
-				<?if OS = "Win32" ?>
-					<CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
-				<?else ?>
-					<CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
-				<?endif ?>
-				<OptimizeCode>false</OptimizeCode>
-				<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
-				<AllowUnsafe>false</AllowUnsafe>
-				<WarningLevel>4</WarningLevel>   
-				<!-The filter for the number of warnings or errors shown and the tolerance level as to what is an error. This is value from 0 to 4 where 4 is the most strict (least tolerent).-->
-
-				<WarningsAsErrors>false</WarningsAsErrors>
-				<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings> 
- 				<!-- A semicolon ';'  delimited list of the warnings that are filtered and not shown in the output window during compiling a project.  Only include the number portion of the warning codes that are shown in output during compilation (eg CS1591, should be entered as 1591)-->
-
-				<OutputPath>..\bin</OutputPath>
-				<DebugInformation>true</DebugInformation>
-				<RegisterComInterop>false</RegisterComInterop>
-				<IncrementalBuild>true</IncrementalBuild>
-				<BaseAddress>285212672</BaseAddress>
-				<FileAlignment>4096</FileAlignment>
-				<NoStdLib>false</NoStdLib>
-				<XmlDocFile>Docs.xml</XmlDocFile>
-			</Options>
-		</Configuration>
-		<Configuration name="Release"> <!-- You can define multple configurations that projects can have, but there is no way to define which one is selected by default as this is a part of the user preferences for a project, not the solution or project files -->
-			<Options>
-				<CompilerDefines>TRACE</CompilerDefines>
-				<OptimizeCode>true</OptimizeCode>
-				<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
-				<AllowUnsafe>false</AllowUnsafe>
-				<WarningLevel>4</WarningLevel>
-				<WarningsAsErrors>false</WarningsAsErrors>
-				<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
-				<OutputPath>..\bin</OutputPath>
-				<DebugInformation>false</DebugInformation>
-				<RegisterComInterop>false</RegisterComInterop>
-				<IncrementalBuild>true</IncrementalBuild>
-				<BaseAddress>285212672</BaseAddress>
-				<FileAlignment>4096</FileAlignment>
-				<NoStdLib>false</NoStdLib>
-				<GenerateXmlDocFile>true</GenerateXmlDocFile>
-				<XmlDocFile>Docs.xml</XmlDocFile>				
-			</Options>
-		</Configuration>
-
-		<!-- One of the projects that is included in the Solution -->
-		<Project name="RealmForge.Utility" Language="VisualBasic" path="Utility" type="Library" assemblyName="RealmForge.Utility" rootNamespace="RealmForge">
-			<Configuration name="Debug">
-				<Options>
-					<OutputPath>..\bin\lib\Utility</OutputPath>
-					<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
-				</Options>
-			</Configuration>
-			<Configuration name="Release">
-				<Options>
-					<OutputPath>..\bin\lib\Utility</OutputPath>
-					<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
-				</Options>
-			</Configuration>
-			<ReferencePath>../bin</ReferencePath>
-			<Reference name="System"/>
-			<Reference name="System.Data"/> 
-			<Reference name="System.Drawing"/>
-			<Reference name="System.Xml"/>
-			<Reference name="System.Runtime.Serialization.Formatters.Soap"/>
-			<Reference name="ICSharpCode.SharpZipLib"/>
-			<Files>
-				<Match path="." pattern="*.vb" recurse="true"/>
-			</Files>
-		</Project>
-
-		<!-- Another projects that is included in the Solution -->
-		<Project name="DemoGame" Language="C#" path="DemoGame" type="WinExe" icon="..\bin\RealmForge.ico" assemblyName="DemoGame" rootNamespace="RealmForge">
-				<!-- icon is used to define the location of the .ico file that is embeeded in the assembly when the project is compiled.  This is relative to the project path -->
-				<!--type defines the type of project, valid types are Library (.dll), WinExe (.exe), and Exe (.exe).  WinExe is not windows specific, it just defines that it is a GUI application and that no Console or Command window will show when it is started-->
-
-			<Configuration name="Debug">
-				<Options>
-					<OutputPath>..\bin</OutputPath>
-					<XmlDocFile>DemoGame.xml</XmlDocFile>
-				</Options>
-			</Configuration>
-			<Configuration name="Release">
-				<Options>
-					<OutputPath>..\bin</OutputPath>
-					<XmlDocFile>DemoGame.xml</XmlDocFile>		
-				</Options>
-			</Configuration>
-			<ReferencePath>../bin</ReferencePath>
-			<Reference name="System"/> <!-- Assemblies that are located in the GAC (installed, global) can be referenced-->
-			<Reference name="ode"/>  <!-- Assemblies that are located in the output directory to which the file is built can be referenced -->
-			<Reference name="RealmForge.Utility"/> <!-- When you reference the name of another project, then that project (and it's output) will be referenced instead of looking for a pre-built assembly-->
-			<Files>
-				<Match path="." pattern="*.cs" recurse="true"/>
-				<Match path="." pattern="*.bmp" recurse="true" buildAction="EmbeddedResource"/>
-				<Match path="." pattern="[^a]*\.(png|jpg)" useRegex="true" buildAction="EmbeddedResource"/>
-				
-				<!-- Uses a regex or regular expression to find all files that end with .png or .jpg but dont have the letter 'a' in their name and add them to the project as EmbeddedResource's.  Because recurse enabled (default is false), only the values in the files in that are directly in the project directory (not child directories) are checked.-->
-				<!--EmbeddedResource, Content, and Compile are valid buildAction's-->
-			</Files>
-		</Project>
-		
-	</Solution>
-</Prebuild>
-
+Prebuild Instructions
+
+Prebuild is an XML-driven pre-build tool allowing developers to easily generate project or make files for major IDE's and .NET development tools including: Visual Studio 2005, Visual Studio 2003, Visual Studio 2002, SharpDevelop, SharpDevelop2, MonoDevelop, and NAnt.
+
+_______________________________________________________________________________
+Overview
+
+Prebuild can be either be run from the command line to generate the
+project and make files or you can execute the included batch (*.bat)
+and Unix Shell script (*.sh) files.
+
+_______________________________________________________________________________
+The currently supported developement tools and their associated batch
+and shell script files.
+
+Visual Studio .NET 2005 (VS2005.bat)
+Visual Studio .NET 2003 (VS2003.bat)
+Visual Studio .NET 2002 (VS2002.bat)
+SharpDevelop (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
+SharpDevelop2 (SharpDevelop.bat) - http://www.icsharpcode.net/OpenSource/SD/
+MonoDevelop (MonoDevelop.sh) - http://www.monodevelop.com/
+NAnt (nant.sh and nant.bat) - http://nant.sourceforge.net/
+Autotools (autotools.bat and autotools.sh) - http://en.wikipedia.org/wiki/GNU_build_system
+
+Notes:
+
+A Unix Shell script is provided for MonoDevelop, as it does not run on
+Windows at this time.
+
+Visual Studio .NET 2005 and the Visual Express IDE's can import
+solutions from older versions of Visual Studio .NET.
+
+Makefiles are not currently supported.
+
+_______________________________________________________________________________
+Command Line Syntax:
+ 
+Example:
+> Prebuild /target vs2003
+
+This will generate the project files for Visual Studio.NET 2003 and
+place the redirect the log to a file named PrebuildLog.txt in the
+parent directory
+
+
+The syntax structure is as below, where commandParameter is optional
+depending on the command and you can provide several option-value
+pairs.
+
+Note: The '> ' signifies the command prompt, do not enter this literally
+
+> Prebuild /<option> <commandParameter>
+
+> Prebuild /target vs2003 /pause
+
+> Prebuild /target vs2003 /log ../Log.txt /pause /ppo /file ProjectConfig.xml
+
+> Prebuild /target sharpdev /log
+
+> Prebuild /removedir obj|bin
+
+> Prebuild /target vs2003 /allowedgroups Group1|Group2
+
+> Prebuild /clean
+
+> Prebuild /clean /yes
+
+> Prebuild /clean vs2003
+
+_______________________________________________________________________________
+Command Line Options:
+
+/usage - Shows the help information on how to use Prebuild and what
+the different options are and what they do
+
+/clean - The project files generated for the target type specified as
+a parameter for this option will be deleted.  If no value is specified
+or if 'all' is specified, then project files for all the target types
+will be deleted.
+
+/target - Specified the name of the development tool for which project
+or make files will be generated.  Possible parameter values include:
+vs2003, vs2002, sharpdev
+
+/file - Specifies the name of the XML which defines what files are to
+be referenced by the generated project files as well as configures the
+options for them.  If not specified, prebuild.xml in the current
+directory will be used as the default.
+
+/log - Specified the log file that should be written to for build
+errors.  If this option is not specified, no log file is generated,
+but if just no value is specified, then the defaul filename will be
+used for the log (Prebuild.log).
+
+/ppo - Preprocesses the xml file to test for syntax errors or problems
+but doesn't generate the files
+
+/pause - Shows the console until you press a key so that you can view
+the messages written while performing the specified actions.
+
+This allows you to check if an errors occurred and - if so - what it
+was.
+
+/showtargets - Shows a list of all the targets that can be specified
+as values for the /clean and /target commands.
+
+/allowedgroups - This is followed by a pipe-delimited list of project
+group filter flags (eg. Group1|Group2) allow optional filtering of all
+projects that dont have at least one of these flags
+
+/removedir - This is followed by a pipe-delimited list of directory
+names that will be deleted while recursivly searching the directory of
+the prebuild application and its child directories (eg. use obj|bin to
+delete all output and temporary directories before file releases)
+
+/yes - Answer yes to any warnings (e.g. when cleaning all projects).
+
+_______________________________________________________________________________
+Example Batch Files and Shell Scripts
+
+NOTE: Common batch and shell script files are included with Prebuild source and file releases.
+______________________________
+MonoDevelop
+
+#!/bin/sh
+# Generates a solution (.mds) and a set of project files (.mdp) 
+
+# for MonoDevelop, a Mono port of SharpDevelop
+#  (http://icsharpcode.net/OpenSource/SD/Default.aspx)
+
+./Prebuild /target monodev /pause
+
+______________________________
+Visual Studio .NET 2003
+
+@rem Generates a solution (.sln) and a set of project files (.csproj) 
+@rem for Microsoft Visual Studio .NET 2002
+Prebuild /target vs2003 /pause
+
+Notes:
+Text after lines that start with @rem are comments and are not evaluated
+You can also place pause on the last line instead of specifing the /pause command.
+
+_______________________________________________________________________________
+Example XML Configuration File
+
+Note:
+
+XML Comments (<!-- Comment -->) are used to markup the prebuild.xml
+file with notes
+
+The below file may be out-of-date, however the RealmForge Prebuild
+file serves as an up-to-date and extensive example.
+
+It can be viewed using Tigris.org's WebSVN
+(http://realmforge.tigris.org/source/browse/realmforge/trunk/src/prebuild.xml)
+by just clicking on the "view file" link for the latest revision.
+
+_________________________________
+
+<?xml version="1.0" encoding="utf-8"?>
+    <!--The version of the XML schema specified in the version and xmlns attributes should match the one for which the version of Prebuild.exe used was compiled for.  In this example it is the version 1.3 schema, you can find the XSD schema file at the url specified in the xmlns attribute. -->
+<Prebuild version="1.6" xmlns="http://dnpb.sourceforge.net/schemas/prebuild-1.6.xsd">
+	<Solution name="RealmForge"> <!--The title and file name for the solution, combine, workspace, or project group (depending on what development tool you are using)-->
+                       <!--Configurations found as children of Solution are used as templates for the configurations found in the project, this allows you to avoid writing the same options in each project (and maintaining each of these).  You can provide defaults and then override them in the configurations defined for each project. All options are optional.-->
+		<Configuration name="Debug">
+			<Options>
+				<!-- simple logically expressions can be evaluated, if, else, elseif, and endif are valid statements.  Note that it is not neccisary to define POSIX or WIN32 -->
+				<?if OS = "Win32" ?>
+					<CompilerDefines>DEBUG;TRACE;WIN32</CompilerDefines>
+				<?else ?>
+					<CompilerDefines>DEBUG;TRACE;POSIX</CompilerDefines>
+				<?endif ?>
+				<OptimizeCode>false</OptimizeCode>
+				<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
+				<AllowUnsafe>false</AllowUnsafe>
+				<WarningLevel>4</WarningLevel>   
+				<!-The filter for the number of warnings or errors shown and the tolerance level as to what is an error. This is value from 0 to 4 where 4 is the most strict (least tolerent).-->
+
+				<WarningsAsErrors>false</WarningsAsErrors>
+				<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings> 
+ 				<!-- A semicolon ';'  delimited list of the warnings that are filtered and not shown in the output window during compiling a project.  Only include the number portion of the warning codes that are shown in output during compilation (eg CS1591, should be entered as 1591)-->
+
+				<OutputPath>..\bin</OutputPath>
+				<DebugInformation>true</DebugInformation>
+				<RegisterComInterop>false</RegisterComInterop>
+				<IncrementalBuild>true</IncrementalBuild>
+				<BaseAddress>285212672</BaseAddress>
+				<FileAlignment>4096</FileAlignment>
+				<NoStdLib>false</NoStdLib>
+				<XmlDocFile>Docs.xml</XmlDocFile>
+			</Options>
+		</Configuration>
+		<Configuration name="Release"> <!-- You can define multple configurations that projects can have, but there is no way to define which one is selected by default as this is a part of the user preferences for a project, not the solution or project files -->
+			<Options>
+				<CompilerDefines>TRACE</CompilerDefines>
+				<OptimizeCode>true</OptimizeCode>
+				<CheckUnderflowOverflow>false</CheckUnderflowOverflow>
+				<AllowUnsafe>false</AllowUnsafe>
+				<WarningLevel>4</WarningLevel>
+				<WarningsAsErrors>false</WarningsAsErrors>
+				<SuppressWarnings>1591;219;1573;1572;168</SuppressWarnings>
+				<OutputPath>..\bin</OutputPath>
+				<DebugInformation>false</DebugInformation>
+				<RegisterComInterop>false</RegisterComInterop>
+				<IncrementalBuild>true</IncrementalBuild>
+				<BaseAddress>285212672</BaseAddress>
+				<FileAlignment>4096</FileAlignment>
+				<NoStdLib>false</NoStdLib>
+				<GenerateXmlDocFile>true</GenerateXmlDocFile>
+				<XmlDocFile>Docs.xml</XmlDocFile>				
+			</Options>
+		</Configuration>
+
+		<!-- One of the projects that is included in the Solution -->
+		<Project name="RealmForge.Utility" Language="VisualBasic" path="Utility" type="Library" assemblyName="RealmForge.Utility" rootNamespace="RealmForge">
+			<Configuration name="Debug">
+				<Options>
+					<OutputPath>..\bin\lib\Utility</OutputPath>
+					<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
+				</Options>
+			</Configuration>
+			<Configuration name="Release">
+				<Options>
+					<OutputPath>..\bin\lib\Utility</OutputPath>
+					<XmlDocFile>RealmForge.Utility.xml</XmlDocFile>
+				</Options>
+			</Configuration>
+			<ReferencePath>../bin</ReferencePath>
+			<Reference name="System"/>
+			<Reference name="System.Data"/> 
+			<Reference name="System.Drawing"/>
+			<Reference name="System.Xml"/>
+			<Reference name="System.Runtime.Serialization.Formatters.Soap"/>
+			<Reference name="ICSharpCode.SharpZipLib"/>
+			<Files>
+				<Match path="." pattern="*.vb" recurse="true"/>
+			</Files>
+		</Project>
+
+		<!-- Another projects that is included in the Solution -->
+		<Project name="DemoGame" Language="C#" path="DemoGame" type="WinExe" icon="..\bin\RealmForge.ico" assemblyName="DemoGame" rootNamespace="RealmForge">
+				<!-- icon is used to define the location of the .ico file that is embeeded in the assembly when the project is compiled.  This is relative to the project path -->
+				<!--type defines the type of project, valid types are Library (.dll), WinExe (.exe), and Exe (.exe).  WinExe is not windows specific, it just defines that it is a GUI application and that no Console or Command window will show when it is started-->
+
+			<Configuration name="Debug">
+				<Options>
+					<OutputPath>..\bin</OutputPath>
+					<XmlDocFile>DemoGame.xml</XmlDocFile>
+				</Options>
+			</Configuration>
+			<Configuration name="Release">
+				<Options>
+					<OutputPath>..\bin</OutputPath>
+					<XmlDocFile>DemoGame.xml</XmlDocFile>		
+				</Options>
+			</Configuration>
+			<ReferencePath>../bin</ReferencePath>
+			<Reference name="System"/> <!-- Assemblies that are located in the GAC (installed, global) can be referenced-->
+			<Reference name="ode"/>  <!-- Assemblies that are located in the output directory to which the file is built can be referenced -->
+			<Reference name="RealmForge.Utility"/> <!-- When you reference the name of another project, then that project (and it's output) will be referenced instead of looking for a pre-built assembly-->
+			<Files>
+				<Match path="." pattern="*.cs" recurse="true"/>
+				<Match path="." pattern="*.bmp" recurse="true" buildAction="EmbeddedResource"/>
+				<Match path="." pattern="[^a]*\.(png|jpg)" useRegex="true" buildAction="EmbeddedResource"/>
+				
+				<!-- Uses a regex or regular expression to find all files that end with .png or .jpg but dont have the letter 'a' in their name and add them to the project as EmbeddedResource's.  Because recurse enabled (default is false), only the values in the files in that are directly in the project directory (not child directories) are checked.-->
+				<!--EmbeddedResource, Content, and Compile are valid buildAction's-->
+			</Files>
+		</Project>
+		
+	</Solution>
+</Prebuild>
+

+ 4 - 4
Prebuild/scripts/.svn/text-base/SharpDevelop2.bat.svn-base

@@ -1,4 +1,4 @@
-@rem Generates a combine (.cmbx) and a set of project files (.prjx) 
-@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
-cd ..
-Prebuild.exe /target sharpdev2 /file prebuild.xml /pause
+@rem Generates a combine (.cmbx) and a set of project files (.prjx) 
+@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
+cd ..
+Prebuild.exe /target sharpdev2 /file prebuild.xml /pause

+ 4 - 4
Prebuild/scripts/.svn/text-base/VS2008.bat.svn-base

@@ -1,4 +1,4 @@
-@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
-@rem for Microsoft Visual Studio .NET 2008
-cd ..
-Prebuild.exe /target vs2008 /file prebuild.xml /pause
+@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
+@rem for Microsoft Visual Studio .NET 2008
+cd ..
+Prebuild.exe /target vs2008 /file prebuild.xml /pause

+ 4 - 4
Prebuild/scripts/.svn/text-base/VS2010.bat.svn-base

@@ -1,4 +1,4 @@
-@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
-@rem for Microsoft Visual Studio .NET 2010
-cd ..
-Prebuild.exe /target vs2010 /file prebuild.xml /pause
+@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
+@rem for Microsoft Visual Studio .NET 2010
+cd ..
+Prebuild.exe /target vs2010 /file prebuild.xml /pause

+ 4 - 4
Prebuild/scripts/.svn/text-base/autotools.bat.svn-base

@@ -1,4 +1,4 @@
-@rem Generates Makefiles 
-@rem for autotools
-cd ..
-Prebuild.exe /target autotools /file prebuild.xml /pause
+@rem Generates Makefiles 
+@rem for autotools
+cd ..
+Prebuild.exe /target autotools /file prebuild.xml /pause

+ 4 - 4
Prebuild/scripts/SharpDevelop2.bat

@@ -1,4 +1,4 @@
-@rem Generates a combine (.cmbx) and a set of project files (.prjx) 
-@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
-cd ..
-Prebuild.exe /target sharpdev2 /file prebuild.xml /pause
+@rem Generates a combine (.cmbx) and a set of project files (.prjx) 
+@rem for SharpDevelop (http://icsharpcode.net/OpenSource/SD/Default.aspx)
+cd ..
+Prebuild.exe /target sharpdev2 /file prebuild.xml /pause

+ 4 - 4
Prebuild/scripts/VS2008.bat

@@ -1,4 +1,4 @@
-@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
-@rem for Microsoft Visual Studio .NET 2008
-cd ..
-Prebuild.exe /target vs2008 /file prebuild.xml /pause
+@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
+@rem for Microsoft Visual Studio .NET 2008
+cd ..
+Prebuild.exe /target vs2008 /file prebuild.xml /pause

+ 4 - 4
Prebuild/scripts/VS2010.bat

@@ -1,4 +1,4 @@
-@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
-@rem for Microsoft Visual Studio .NET 2010
-cd ..
-Prebuild.exe /target vs2010 /file prebuild.xml /pause
+@rem Generates a solution (.sln) and a set of project files (.csproj, .vbproj, etc.)
+@rem for Microsoft Visual Studio .NET 2010
+cd ..
+Prebuild.exe /target vs2010 /file prebuild.xml /pause

+ 4 - 4
Prebuild/scripts/autotools.bat

@@ -1,4 +1,4 @@
-@rem Generates Makefiles 
-@rem for autotools
-cd ..
-Prebuild.exe /target autotools /file prebuild.xml /pause
+@rem Generates Makefiles 
+@rem for autotools
+cd ..
+Prebuild.exe /target autotools /file prebuild.xml /pause

+ 79 - 79
Prebuild/src/Core/Nodes/.svn/text-base/CleanFilesNode.cs.svn-base

@@ -1,80 +1,80 @@
-#region BSD License
-/*
-Copyright (c) 2007 C.J. Adams-Collier ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions 
-  and the following disclaimer. 
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
-  and the following disclaimer in the documentation and/or other materials provided with the 
-  distribution. 
-* The name of the author may not be used to endorse or promote products derived from this software 
-  without specific prior written permission. 
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("CleanFiles")]
-    public class CleanFilesNode : DataNode
-    {
-        #region Fields
-
-        private string m_Pattern;
-
-        #endregion
-
-        #region Properties
-
-        /// <summary>
-        /// Gets the signature.
-        /// </summary>
-        /// <value>The signature.</value>
-        public string Pattern
-        {
-            get
-            {
-                return m_Pattern;
-            }
-        }
-
-        #endregion
-
-        #region Public Methods
-
-        /// <summary>
-        /// Parses the specified node.
-        /// </summary>
-        /// <param name="node">The node.</param>
-        public override void Parse(XmlNode node)
-        {
-            if (node == null)
-            {
-                throw new ArgumentNullException("node");
-            }
-
-            m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ;
-            m_Pattern = m_Pattern.Trim();
-        }
-
-        #endregion
-    }
+#region BSD License
+/*
+Copyright (c) 2007 C.J. Adams-Collier ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions 
+  and the following disclaimer. 
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
+  and the following disclaimer in the documentation and/or other materials provided with the 
+  distribution. 
+* The name of the author may not be used to endorse or promote products derived from this software 
+  without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("CleanFiles")]
+    public class CleanFilesNode : DataNode
+    {
+        #region Fields
+
+        private string m_Pattern;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Gets the signature.
+        /// </summary>
+        /// <value>The signature.</value>
+        public string Pattern
+        {
+            get
+            {
+                return m_Pattern;
+            }
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Parses the specified node.
+        /// </summary>
+        /// <param name="node">The node.</param>
+        public override void Parse(XmlNode node)
+        {
+            if (node == null)
+            {
+                throw new ArgumentNullException("node");
+            }
+
+            m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ;
+            m_Pattern = m_Pattern.Trim();
+        }
+
+        #endregion
+    }
 }

+ 84 - 84
Prebuild/src/Core/Nodes/.svn/text-base/CleanupNode.cs.svn-base

@@ -1,85 +1,85 @@
-#region BSD License
-/*
-Copyright (c) 2007 C.J. Adams-Collier ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions 
-  and the following disclaimer. 
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
-  and the following disclaimer in the documentation and/or other materials provided with the 
-  distribution. 
-* The name of the author may not be used to endorse or promote products derived from this software 
-  without specific prior written permission. 
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("Cleanup")]
-    public class CleanupNode : DataNode
-    {
-		#region Fields
-
-		private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
-
-		#endregion
-
-		#region Properties
-
-		/// <summary>
-		/// Gets the signature.
-		/// </summary>
-		/// <value>The signature.</value>
-        public List<CleanFilesNode> CleanFiles
-		{
-			get
-			{
-				return m_CleanFiles;
-			}
-		}
-
-		#endregion
-
-		#region Public Methods
-
-		/// <summary>
-		/// Parses the specified node.
-		/// </summary>
-		/// <param name="node">The node.</param>
-		public override void Parse(XmlNode node)
-		{
-			if( node == null )
-			{
-				throw new ArgumentNullException("node");
-			}
-
-            foreach (XmlNode child in node.ChildNodes)
-            {
-                IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
-                if (dataNode is CleanFilesNode)
-                {
-                    m_CleanFiles.Add((CleanFilesNode)dataNode);
-                }
-            }
-		}
-
-		#endregion
-    }
+#region BSD License
+/*
+Copyright (c) 2007 C.J. Adams-Collier ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions 
+  and the following disclaimer. 
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
+  and the following disclaimer in the documentation and/or other materials provided with the 
+  distribution. 
+* The name of the author may not be used to endorse or promote products derived from this software 
+  without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("Cleanup")]
+    public class CleanupNode : DataNode
+    {
+		#region Fields
+
+		private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
+
+		#endregion
+
+		#region Properties
+
+		/// <summary>
+		/// Gets the signature.
+		/// </summary>
+		/// <value>The signature.</value>
+        public List<CleanFilesNode> CleanFiles
+		{
+			get
+			{
+				return m_CleanFiles;
+			}
+		}
+
+		#endregion
+
+		#region Public Methods
+
+		/// <summary>
+		/// Parses the specified node.
+		/// </summary>
+		/// <param name="node">The node.</param>
+		public override void Parse(XmlNode node)
+		{
+			if( node == null )
+			{
+				throw new ArgumentNullException("node");
+			}
+
+            foreach (XmlNode child in node.ChildNodes)
+            {
+                IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+                if (dataNode is CleanFilesNode)
+                {
+                    m_CleanFiles.Add((CleanFilesNode)dataNode);
+                }
+            }
+		}
+
+		#endregion
+    }
 }

+ 71 - 71
Prebuild/src/Core/Nodes/.svn/text-base/ConfigurationNodeCollection.cs.svn-base

@@ -1,71 +1,71 @@
-#region BSD License
-/*
-Copyright (c) 2004-2005 Matthew Holmes ([email protected]), Dan Moorehead ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions 
-  and the following disclaimer. 
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
-  and the following disclaimer in the documentation and/or other materials provided with the 
-  distribution. 
-* The name of the author may not be used to endorse or promote products derived from this software 
-  without specific prior written permission. 
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System.Collections.Generic;
-
-namespace Prebuild.Core.Nodes
-{
-	/// <summary>
-	/// Implements a specialized list of configuration nodes which allows for lookup via
-	/// configuration name and platform.
-	/// </summary>
-	public class ConfigurationNodeCollection : List<ConfigurationNode>
-	{
-		#region Properties
-
-		public ConfigurationNode this[string nameAndPlatform]
-		{
-			get
-			{
-				foreach (ConfigurationNode configurationNode in this)
-				{
-					if (configurationNode.NameAndPlatform == nameAndPlatform)
-					{
-						return configurationNode;
-					}
-				}
-
-				return null;
-			}
-
-			set
-			{
-				// See if the node 
-				ConfigurationNode configurationNode = this[nameAndPlatform];
-
-				if (configurationNode != null)
-				{
-					this[IndexOf(configurationNode)] = value;
-				}
-				else
-				{
-					Add(value);
-				}
-			}
-		}
-
-		#endregion
-	}
-}
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes ([email protected]), Dan Moorehead ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions 
+  and the following disclaimer. 
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
+  and the following disclaimer in the documentation and/or other materials provided with the 
+  distribution. 
+* The name of the author may not be used to endorse or promote products derived from this software 
+  without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System.Collections.Generic;
+
+namespace Prebuild.Core.Nodes
+{
+	/// <summary>
+	/// Implements a specialized list of configuration nodes which allows for lookup via
+	/// configuration name and platform.
+	/// </summary>
+	public class ConfigurationNodeCollection : List<ConfigurationNode>
+	{
+		#region Properties
+
+		public ConfigurationNode this[string nameAndPlatform]
+		{
+			get
+			{
+				foreach (ConfigurationNode configurationNode in this)
+				{
+					if (configurationNode.NameAndPlatform == nameAndPlatform)
+					{
+						return configurationNode;
+					}
+				}
+
+				return null;
+			}
+
+			set
+			{
+				// See if the node 
+				ConfigurationNode configurationNode = this[nameAndPlatform];
+
+				if (configurationNode != null)
+				{
+					this[IndexOf(configurationNode)] = value;
+				}
+				else
+				{
+					Add(value);
+				}
+			}
+		}
+
+		#endregion
+	}
+}

+ 93 - 93
Prebuild/src/Core/Nodes/.svn/text-base/DatabaseProjectNode.cs.svn-base

@@ -1,93 +1,93 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("DatabaseProject")]
-    public class DatabaseProjectNode : DataNode
-    {
-        string name;
-        string path;
-        string fullpath;
-        Guid guid = Guid.NewGuid();
-        readonly List<AuthorNode> authors = new List<AuthorNode>();
-        readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>();
-
-        public Guid Guid
-        {
-            get { return guid; }
-        }
-
-        public string Name
-        {
-            get { return name; }
-        }
-
-        public string Path
-        {
-            get { return path; }
-        }
-
-        public string FullPath
-        {
-            get { return fullpath; }
-        }
-
-        public IEnumerable<DatabaseReferenceNode> References
-        {
-            get { return references; }
-        }
-
-        public override void Parse(XmlNode node)
-        {
-            name = Helper.AttributeValue(node, "name", name);
-            path = Helper.AttributeValue(node, "path", name);
-
-            try
-            {
-                fullpath = Helper.ResolvePath(path);
-            }
-            catch
-            {
-                throw new WarningException("Could not resolve Solution path: {0}", path);
-            }
-
-            Kernel.Instance.CurrentWorkingDirectory.Push();
-
-            try
-            {
-                Helper.SetCurrentDir(fullpath);
-
-                if (node == null)
-                {
-                    throw new ArgumentNullException("node");
-                }
-
-                foreach (XmlNode child in node.ChildNodes)
-                {
-                    IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
-
-                    if (dataNode == null)
-                        continue;
-
-                    if (dataNode is AuthorNode)
-                        authors.Add((AuthorNode)dataNode);
-                    else if (dataNode is DatabaseReferenceNode)
-                        references.Add((DatabaseReferenceNode)dataNode);
-                }
-            }
-            finally
-            {
-                Kernel.Instance.CurrentWorkingDirectory.Pop();
-            }
-
-            base.Parse(node);
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("DatabaseProject")]
+    public class DatabaseProjectNode : DataNode
+    {
+        string name;
+        string path;
+        string fullpath;
+        Guid guid = Guid.NewGuid();
+        readonly List<AuthorNode> authors = new List<AuthorNode>();
+        readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>();
+
+        public Guid Guid
+        {
+            get { return guid; }
+        }
+
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public string Path
+        {
+            get { return path; }
+        }
+
+        public string FullPath
+        {
+            get { return fullpath; }
+        }
+
+        public IEnumerable<DatabaseReferenceNode> References
+        {
+            get { return references; }
+        }
+
+        public override void Parse(XmlNode node)
+        {
+            name = Helper.AttributeValue(node, "name", name);
+            path = Helper.AttributeValue(node, "path", name);
+
+            try
+            {
+                fullpath = Helper.ResolvePath(path);
+            }
+            catch
+            {
+                throw new WarningException("Could not resolve Solution path: {0}", path);
+            }
+
+            Kernel.Instance.CurrentWorkingDirectory.Push();
+
+            try
+            {
+                Helper.SetCurrentDir(fullpath);
+
+                if (node == null)
+                {
+                    throw new ArgumentNullException("node");
+                }
+
+                foreach (XmlNode child in node.ChildNodes)
+                {
+                    IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+
+                    if (dataNode == null)
+                        continue;
+
+                    if (dataNode is AuthorNode)
+                        authors.Add((AuthorNode)dataNode);
+                    else if (dataNode is DatabaseReferenceNode)
+                        references.Add((DatabaseReferenceNode)dataNode);
+                }
+            }
+            finally
+            {
+                Kernel.Instance.CurrentWorkingDirectory.Pop();
+            }
+
+            base.Parse(node);
+        }
+    }
+}

+ 63 - 63
Prebuild/src/Core/Nodes/.svn/text-base/DatabaseReferenceNode.cs.svn-base

@@ -1,63 +1,63 @@
-using System;
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("DatabaseReference")]
-    public class DatabaseReferenceNode : DataNode
-    {
-        string name;
-        Guid providerId;
-        string connectionString;
-
-        public string Name
-        {
-            get { return name; }
-        }
-
-        public Guid ProviderId
-        {
-            get { return providerId; }
-        }
-
-        public string ConnectionString
-        {
-            get { return connectionString; }
-        }
-
-        public override void Parse(System.Xml.XmlNode node)
-        {
-            name = Helper.AttributeValue(node, "name", name);
-
-            string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
-            if (providerName != null)
-            {
-                switch (providerName)
-                {
-                    // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
-                    // Not sure if these will help other operating systems, or if there's a better way.
-                    case "Microsoft.SqlServerCe.Client.3.5":
-                        providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
-                    case "System.Data.OleDb":
-                        providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
-                    case "System.Data.OracleClient":
-                        providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
-                    case "System.Data.SqlClient": 
-                        providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
-                    case "System.Data.Odbc":
-                        providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
-                    
-                    default:
-                        throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
-                }
-            }
-            else
-                providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
-            
-            connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
-
-            base.Parse(node);
-        }
-    }
-}
+using System;
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("DatabaseReference")]
+    public class DatabaseReferenceNode : DataNode
+    {
+        string name;
+        Guid providerId;
+        string connectionString;
+
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public Guid ProviderId
+        {
+            get { return providerId; }
+        }
+
+        public string ConnectionString
+        {
+            get { return connectionString; }
+        }
+
+        public override void Parse(System.Xml.XmlNode node)
+        {
+            name = Helper.AttributeValue(node, "name", name);
+
+            string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
+            if (providerName != null)
+            {
+                switch (providerName)
+                {
+                    // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
+                    // Not sure if these will help other operating systems, or if there's a better way.
+                    case "Microsoft.SqlServerCe.Client.3.5":
+                        providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
+                    case "System.Data.OleDb":
+                        providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
+                    case "System.Data.OracleClient":
+                        providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
+                    case "System.Data.SqlClient": 
+                        providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
+                    case "System.Data.Odbc":
+                        providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
+                    
+                    default:
+                        throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
+                }
+            }
+            else
+                providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
+            
+            connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
+
+            base.Parse(node);
+        }
+    }
+}

+ 79 - 79
Prebuild/src/Core/Nodes/CleanFilesNode.cs

@@ -1,80 +1,80 @@
-#region BSD License
-/*
-Copyright (c) 2007 C.J. Adams-Collier ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions 
-  and the following disclaimer. 
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
-  and the following disclaimer in the documentation and/or other materials provided with the 
-  distribution. 
-* The name of the author may not be used to endorse or promote products derived from this software 
-  without specific prior written permission. 
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("CleanFiles")]
-    public class CleanFilesNode : DataNode
-    {
-        #region Fields
-
-        private string m_Pattern;
-
-        #endregion
-
-        #region Properties
-
-        /// <summary>
-        /// Gets the signature.
-        /// </summary>
-        /// <value>The signature.</value>
-        public string Pattern
-        {
-            get
-            {
-                return m_Pattern;
-            }
-        }
-
-        #endregion
-
-        #region Public Methods
-
-        /// <summary>
-        /// Parses the specified node.
-        /// </summary>
-        /// <param name="node">The node.</param>
-        public override void Parse(XmlNode node)
-        {
-            if (node == null)
-            {
-                throw new ArgumentNullException("node");
-            }
-
-            m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ;
-            m_Pattern = m_Pattern.Trim();
-        }
-
-        #endregion
-    }
+#region BSD License
+/*
+Copyright (c) 2007 C.J. Adams-Collier ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions 
+  and the following disclaimer. 
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
+  and the following disclaimer in the documentation and/or other materials provided with the 
+  distribution. 
+* The name of the author may not be used to endorse or promote products derived from this software 
+  without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("CleanFiles")]
+    public class CleanFilesNode : DataNode
+    {
+        #region Fields
+
+        private string m_Pattern;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Gets the signature.
+        /// </summary>
+        /// <value>The signature.</value>
+        public string Pattern
+        {
+            get
+            {
+                return m_Pattern;
+            }
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Parses the specified node.
+        /// </summary>
+        /// <param name="node">The node.</param>
+        public override void Parse(XmlNode node)
+        {
+            if (node == null)
+            {
+                throw new ArgumentNullException("node");
+            }
+
+            m_Pattern = Helper.AttributeValue(node, "pattern", String.Empty); ;
+            m_Pattern = m_Pattern.Trim();
+        }
+
+        #endregion
+    }
 }

+ 84 - 84
Prebuild/src/Core/Nodes/CleanupNode.cs

@@ -1,85 +1,85 @@
-#region BSD License
-/*
-Copyright (c) 2007 C.J. Adams-Collier ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions 
-  and the following disclaimer. 
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
-  and the following disclaimer in the documentation and/or other materials provided with the 
-  distribution. 
-* The name of the author may not be used to endorse or promote products derived from this software 
-  without specific prior written permission. 
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("Cleanup")]
-    public class CleanupNode : DataNode
-    {
-		#region Fields
-
-		private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
-
-		#endregion
-
-		#region Properties
-
-		/// <summary>
-		/// Gets the signature.
-		/// </summary>
-		/// <value>The signature.</value>
-        public List<CleanFilesNode> CleanFiles
-		{
-			get
-			{
-				return m_CleanFiles;
-			}
-		}
-
-		#endregion
-
-		#region Public Methods
-
-		/// <summary>
-		/// Parses the specified node.
-		/// </summary>
-		/// <param name="node">The node.</param>
-		public override void Parse(XmlNode node)
-		{
-			if( node == null )
-			{
-				throw new ArgumentNullException("node");
-			}
-
-            foreach (XmlNode child in node.ChildNodes)
-            {
-                IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
-                if (dataNode is CleanFilesNode)
-                {
-                    m_CleanFiles.Add((CleanFilesNode)dataNode);
-                }
-            }
-		}
-
-		#endregion
-    }
+#region BSD License
+/*
+Copyright (c) 2007 C.J. Adams-Collier ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions 
+  and the following disclaimer. 
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
+  and the following disclaimer in the documentation and/or other materials provided with the 
+  distribution. 
+* The name of the author may not be used to endorse or promote products derived from this software 
+  without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("Cleanup")]
+    public class CleanupNode : DataNode
+    {
+		#region Fields
+
+		private List<CleanFilesNode> m_CleanFiles = new List<CleanFilesNode>();
+
+		#endregion
+
+		#region Properties
+
+		/// <summary>
+		/// Gets the signature.
+		/// </summary>
+		/// <value>The signature.</value>
+        public List<CleanFilesNode> CleanFiles
+		{
+			get
+			{
+				return m_CleanFiles;
+			}
+		}
+
+		#endregion
+
+		#region Public Methods
+
+		/// <summary>
+		/// Parses the specified node.
+		/// </summary>
+		/// <param name="node">The node.</param>
+		public override void Parse(XmlNode node)
+		{
+			if( node == null )
+			{
+				throw new ArgumentNullException("node");
+			}
+
+            foreach (XmlNode child in node.ChildNodes)
+            {
+                IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+                if (dataNode is CleanFilesNode)
+                {
+                    m_CleanFiles.Add((CleanFilesNode)dataNode);
+                }
+            }
+		}
+
+		#endregion
+    }
 }

+ 71 - 71
Prebuild/src/Core/Nodes/ConfigurationNodeCollection.cs

@@ -1,71 +1,71 @@
-#region BSD License
-/*
-Copyright (c) 2004-2005 Matthew Holmes ([email protected]), Dan Moorehead ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this list of conditions 
-  and the following disclaimer. 
-* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
-  and the following disclaimer in the documentation and/or other materials provided with the 
-  distribution. 
-* The name of the author may not be used to endorse or promote products derived from this software 
-  without specific prior written permission. 
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-#endregion
-
-using System.Collections.Generic;
-
-namespace Prebuild.Core.Nodes
-{
-	/// <summary>
-	/// Implements a specialized list of configuration nodes which allows for lookup via
-	/// configuration name and platform.
-	/// </summary>
-	public class ConfigurationNodeCollection : List<ConfigurationNode>
-	{
-		#region Properties
-
-		public ConfigurationNode this[string nameAndPlatform]
-		{
-			get
-			{
-				foreach (ConfigurationNode configurationNode in this)
-				{
-					if (configurationNode.NameAndPlatform == nameAndPlatform)
-					{
-						return configurationNode;
-					}
-				}
-
-				return null;
-			}
-
-			set
-			{
-				// See if the node 
-				ConfigurationNode configurationNode = this[nameAndPlatform];
-
-				if (configurationNode != null)
-				{
-					this[IndexOf(configurationNode)] = value;
-				}
-				else
-				{
-					Add(value);
-				}
-			}
-		}
-
-		#endregion
-	}
-}
+#region BSD License
+/*
+Copyright (c) 2004-2005 Matthew Holmes ([email protected]), Dan Moorehead ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions 
+  and the following disclaimer. 
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions 
+  and the following disclaimer in the documentation and/or other materials provided with the 
+  distribution. 
+* The name of the author may not be used to endorse or promote products derived from this software 
+  without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+#endregion
+
+using System.Collections.Generic;
+
+namespace Prebuild.Core.Nodes
+{
+	/// <summary>
+	/// Implements a specialized list of configuration nodes which allows for lookup via
+	/// configuration name and platform.
+	/// </summary>
+	public class ConfigurationNodeCollection : List<ConfigurationNode>
+	{
+		#region Properties
+
+		public ConfigurationNode this[string nameAndPlatform]
+		{
+			get
+			{
+				foreach (ConfigurationNode configurationNode in this)
+				{
+					if (configurationNode.NameAndPlatform == nameAndPlatform)
+					{
+						return configurationNode;
+					}
+				}
+
+				return null;
+			}
+
+			set
+			{
+				// See if the node 
+				ConfigurationNode configurationNode = this[nameAndPlatform];
+
+				if (configurationNode != null)
+				{
+					this[IndexOf(configurationNode)] = value;
+				}
+				else
+				{
+					Add(value);
+				}
+			}
+		}
+
+		#endregion
+	}
+}

+ 93 - 93
Prebuild/src/Core/Nodes/DatabaseProjectNode.cs

@@ -1,93 +1,93 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Xml;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("DatabaseProject")]
-    public class DatabaseProjectNode : DataNode
-    {
-        string name;
-        string path;
-        string fullpath;
-        Guid guid = Guid.NewGuid();
-        readonly List<AuthorNode> authors = new List<AuthorNode>();
-        readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>();
-
-        public Guid Guid
-        {
-            get { return guid; }
-        }
-
-        public string Name
-        {
-            get { return name; }
-        }
-
-        public string Path
-        {
-            get { return path; }
-        }
-
-        public string FullPath
-        {
-            get { return fullpath; }
-        }
-
-        public IEnumerable<DatabaseReferenceNode> References
-        {
-            get { return references; }
-        }
-
-        public override void Parse(XmlNode node)
-        {
-            name = Helper.AttributeValue(node, "name", name);
-            path = Helper.AttributeValue(node, "path", name);
-
-            try
-            {
-                fullpath = Helper.ResolvePath(path);
-            }
-            catch
-            {
-                throw new WarningException("Could not resolve Solution path: {0}", path);
-            }
-
-            Kernel.Instance.CurrentWorkingDirectory.Push();
-
-            try
-            {
-                Helper.SetCurrentDir(fullpath);
-
-                if (node == null)
-                {
-                    throw new ArgumentNullException("node");
-                }
-
-                foreach (XmlNode child in node.ChildNodes)
-                {
-                    IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
-
-                    if (dataNode == null)
-                        continue;
-
-                    if (dataNode is AuthorNode)
-                        authors.Add((AuthorNode)dataNode);
-                    else if (dataNode is DatabaseReferenceNode)
-                        references.Add((DatabaseReferenceNode)dataNode);
-                }
-            }
-            finally
-            {
-                Kernel.Instance.CurrentWorkingDirectory.Pop();
-            }
-
-            base.Parse(node);
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("DatabaseProject")]
+    public class DatabaseProjectNode : DataNode
+    {
+        string name;
+        string path;
+        string fullpath;
+        Guid guid = Guid.NewGuid();
+        readonly List<AuthorNode> authors = new List<AuthorNode>();
+        readonly List<DatabaseReferenceNode> references = new List<DatabaseReferenceNode>();
+
+        public Guid Guid
+        {
+            get { return guid; }
+        }
+
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public string Path
+        {
+            get { return path; }
+        }
+
+        public string FullPath
+        {
+            get { return fullpath; }
+        }
+
+        public IEnumerable<DatabaseReferenceNode> References
+        {
+            get { return references; }
+        }
+
+        public override void Parse(XmlNode node)
+        {
+            name = Helper.AttributeValue(node, "name", name);
+            path = Helper.AttributeValue(node, "path", name);
+
+            try
+            {
+                fullpath = Helper.ResolvePath(path);
+            }
+            catch
+            {
+                throw new WarningException("Could not resolve Solution path: {0}", path);
+            }
+
+            Kernel.Instance.CurrentWorkingDirectory.Push();
+
+            try
+            {
+                Helper.SetCurrentDir(fullpath);
+
+                if (node == null)
+                {
+                    throw new ArgumentNullException("node");
+                }
+
+                foreach (XmlNode child in node.ChildNodes)
+                {
+                    IDataNode dataNode = Kernel.Instance.ParseNode(child, this);
+
+                    if (dataNode == null)
+                        continue;
+
+                    if (dataNode is AuthorNode)
+                        authors.Add((AuthorNode)dataNode);
+                    else if (dataNode is DatabaseReferenceNode)
+                        references.Add((DatabaseReferenceNode)dataNode);
+                }
+            }
+            finally
+            {
+                Kernel.Instance.CurrentWorkingDirectory.Pop();
+            }
+
+            base.Parse(node);
+        }
+    }
+}

+ 63 - 63
Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs

@@ -1,63 +1,63 @@
-using System;
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Nodes
-{
-    [DataNode("DatabaseReference")]
-    public class DatabaseReferenceNode : DataNode
-    {
-        string name;
-        Guid providerId;
-        string connectionString;
-
-        public string Name
-        {
-            get { return name; }
-        }
-
-        public Guid ProviderId
-        {
-            get { return providerId; }
-        }
-
-        public string ConnectionString
-        {
-            get { return connectionString; }
-        }
-
-        public override void Parse(System.Xml.XmlNode node)
-        {
-            name = Helper.AttributeValue(node, "name", name);
-
-            string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
-            if (providerName != null)
-            {
-                switch (providerName)
-                {
-                    // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
-                    // Not sure if these will help other operating systems, or if there's a better way.
-                    case "Microsoft.SqlServerCe.Client.3.5":
-                        providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
-                    case "System.Data.OleDb":
-                        providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
-                    case "System.Data.OracleClient":
-                        providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
-                    case "System.Data.SqlClient": 
-                        providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
-                    case "System.Data.Odbc":
-                        providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
-                    
-                    default:
-                        throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
-                }
-            }
-            else
-                providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
-            
-            connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
-
-            base.Parse(node);
-        }
-    }
-}
+using System;
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Nodes
+{
+    [DataNode("DatabaseReference")]
+    public class DatabaseReferenceNode : DataNode
+    {
+        string name;
+        Guid providerId;
+        string connectionString;
+
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public Guid ProviderId
+        {
+            get { return providerId; }
+        }
+
+        public string ConnectionString
+        {
+            get { return connectionString; }
+        }
+
+        public override void Parse(System.Xml.XmlNode node)
+        {
+            name = Helper.AttributeValue(node, "name", name);
+
+            string providerName = Helper.AttributeValue(node, "providerName", string.Empty);
+            if (providerName != null)
+            {
+                switch (providerName)
+                {
+                    // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\*
+                    // Not sure if these will help other operating systems, or if there's a better way.
+                    case "Microsoft.SqlServerCe.Client.3.5":
+                        providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break;
+                    case "System.Data.OleDb":
+                        providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break;
+                    case "System.Data.OracleClient":
+                        providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break;
+                    case "System.Data.SqlClient": 
+                        providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break;
+                    case "System.Data.Odbc":
+                        providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break;
+                    
+                    default:
+                        throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id.");
+                }
+            }
+            else
+                providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B")));
+            
+            connectionString = Helper.AttributeValue(node, "connectionString", connectionString);
+
+            base.Parse(node);
+        }
+    }
+}

+ 1070 - 1070
Prebuild/src/Core/Targets/.svn/text-base/AutotoolsTarget.cs.svn-base

@@ -1,1070 +1,1070 @@
-#region BSD License
-/*
-
-Copyright (c) 2004 - 2008
-Matthew Holmes        ([email protected]),
-Dan     Moorehead     ([email protected]),
-Dave    Hudson        ([email protected]),
-C.J.    Adams-Collier ([email protected]),
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-* The name of the author may not be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-*/
-#endregion
-
-#region MIT X11 license
-
-/*
- Portions of this file authored by Lluis Sanchez Gual
-
- Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- 
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#endregion
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Net;
-using System.Diagnostics;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Targets
-{
-    public enum ClrVersion
-    {
-        Default,
-        Net_1_1,
-        Net_2_0
-    }
-
-    public class SystemPackage
-    {
-        string name;
-        string version;
-        string description;
-        string[] assemblies;
-        bool isInternal;
-        ClrVersion targetVersion;
-
-        public void Initialize(string name,
-                               string version,
-                               string description,
-                               string[] assemblies,
-                               ClrVersion targetVersion,
-                               bool isInternal)
-        {
-            this.isInternal = isInternal;
-            this.name = name;
-            this.version = version;
-            this.assemblies = assemblies;
-            this.description = description;
-            this.targetVersion = targetVersion;
-        }
-
-        public string Name
-        {
-            get { return name; }
-        }
-
-        public string Version
-        {
-            get { return version; }
-        }
-
-        public string Description
-        {
-            get { return description; }
-        }
-
-        public ClrVersion TargetVersion
-        {
-            get { return targetVersion; }
-        }
-
-        // The package is part of the mono SDK
-        public bool IsCorePackage
-        {
-            get { return name == "mono"; }
-        }
-
-        // The package has been registered by an add-in, and is not installed
-        // in the system.
-        public bool IsInternalPackage
-        {
-            get { return isInternal; }
-        }
-
-        public string[] Assemblies
-        {
-            get { return assemblies; }
-        }
-
-    }
-
-
-    /// <summary>
-    /// 
-    /// </summary>
-    [Target("autotools")]
-    public class AutotoolsTarget : ITarget
-    {
-        #region Fields
-
-        Kernel m_Kernel;
-        XmlDocument autotoolsDoc;
-        XmlUrlResolver xr;
-        System.Security.Policy.Evidence e;
-        readonly Dictionary<string, SystemPackage> assemblyPathToPackage = new Dictionary<string, SystemPackage>();
-        readonly Dictionary<string, string> assemblyFullNameToPath = new Dictionary<string, string>();
-        readonly Dictionary<string, SystemPackage> packagesHash = new Dictionary<string, SystemPackage>();
-        readonly List<SystemPackage> packages = new List<SystemPackage>();
-
-        #endregion
-
-        #region Private Methods
-
-        private static void mkdirDashP(string dirName)
-        {
-            DirectoryInfo di = new DirectoryInfo(dirName);
-            if (di.Exists)
-                return;
-
-            string parentDirName = System.IO.Path.GetDirectoryName(dirName);
-            DirectoryInfo parentDi = new DirectoryInfo(parentDirName);
-            if (!parentDi.Exists)
-                mkdirDashP(parentDirName);
-
-            di.Create();
-        }
-
-        private static void chkMkDir(string dirName)
-        {
-            System.IO.DirectoryInfo di =
-                new System.IO.DirectoryInfo(dirName);
-
-            if (!di.Exists)
-                di.Create();
-        }
-
-        private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
-        {
-            // Create an XslTransform for this file
-            XslTransform templateTransformer =
-                new XslTransform();
-
-            // Load up the template
-            XmlNode templateNode =
-                autotoolsDoc.SelectSingleNode(nodeName + "/*");
-            templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
-
-            // Create a writer for the transformed template
-            XmlTextWriter templateWriter =
-                new XmlTextWriter(filename, null);
-
-            // Perform transformation, writing the file
-            templateTransformer.Transform
-                (m_Kernel.CurrentDoc, argList, templateWriter, xr);
-        }
-
-        static string NormalizeAsmName(string name)
-        {
-            int i = name.IndexOf(", PublicKeyToken=null");
-            if (i != -1)
-                return name.Substring(0, i).Trim();
-            return name;
-        }
-
-        private void AddAssembly(string assemblyfile, SystemPackage package)
-        {
-            if (!File.Exists(assemblyfile))
-                return;
-
-            try
-            {
-                System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile);
-                assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
-                assemblyPathToPackage[assemblyfile] = package;
-            }
-            catch
-            {
-            }
-        }
-
-        private static List<string> GetAssembliesWithLibInfo(string line, string file)
-        {
-            List<string> references = new List<string>();
-            List<string> libdirs = new List<string>();
-            List<string> retval = new List<string>();
-            foreach (string piece in line.Split(' '))
-            {
-                if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
-                {
-                    references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
-                }
-                else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
-                {
-                    libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
-                }
-            }
-
-            foreach (string refrnc in references)
-            {
-                foreach (string libdir in libdirs)
-                {
-                    if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
-                    {
-                        retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
-                    }
-                }
-            }
-
-            return retval;
-        }
-
-        private static List<string> GetAssembliesWithoutLibInfo(string line, string file)
-        {
-            List<string> references = new List<string>();
-            foreach (string reference in line.Split(' '))
-            {
-                if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
-                {
-                    string final_ref = reference.Substring(3).Trim();
-                    references.Add(ProcessPiece(final_ref, file));
-                }
-            }
-            return references;
-        }
-
-        private static string ProcessPiece(string piece, string pcfile)
-        {
-            int start = piece.IndexOf("${");
-            if (start == -1)
-                return piece;
-
-            int end = piece.IndexOf("}");
-            if (end == -1)
-                return piece;
-
-            string variable = piece.Substring(start + 2, end - start - 2);
-            string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
-            return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
-        }
-
-        private static string GetVariableFromPkgConfig(string var, string pcfile)
-        {
-            ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
-            psi.RedirectStandardOutput = true;
-            psi.UseShellExecute = false;
-            psi.Arguments = String.Format("--variable={0} {1}", var, pcfile);
-            Process p = new Process();
-            p.StartInfo = psi;
-            p.Start();
-            string ret = p.StandardOutput.ReadToEnd().Trim();
-            p.WaitForExit();
-            if (String.IsNullOrEmpty(ret))
-                return String.Empty;
-            return ret;
-        }
-
-        private void ParsePCFile(string pcfile)
-        {
-            // Don't register the package twice
-            string pname = Path.GetFileNameWithoutExtension(pcfile);
-            if (packagesHash.ContainsKey(pname))
-                return;
-
-            List<string> fullassemblies = null;
-            string version = "";
-            string desc = "";
-
-            SystemPackage package = new SystemPackage();
-
-            using (StreamReader reader = new StreamReader(pcfile))
-            {
-                string line;
-                while ((line = reader.ReadLine()) != null)
-                {
-                    string lowerLine = line.ToLower();
-                    if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
-                    {
-                        string choppedLine = line.Substring(5).Trim();
-                        if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
-                        {
-                            fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
-                        }
-                        else
-                        {
-                            fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
-                        }
-                    }
-                    else if (lowerLine.StartsWith("version:"))
-                    {
-                        // "version:".Length == 8
-                        version = line.Substring(8).Trim();
-                    }
-                    else if (lowerLine.StartsWith("description:"))
-                    {
-                        // "description:".Length == 12
-                        desc = line.Substring(12).Trim();
-                    }
-                }
-            }
-
-            if (fullassemblies == null)
-                return;
-
-            foreach (string assembly in fullassemblies)
-            {
-                AddAssembly(assembly, package);
-            }
-
-            package.Initialize(pname,
-                               version,
-                               desc,
-                               fullassemblies.ToArray(),
-                               ClrVersion.Default,
-                               false);
-            packages.Add(package);
-            packagesHash[pname] = package;
-        }
-
-        void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
-        {
-            SystemPackage package = new SystemPackage();
-            List<string> list = new List<string>();
-
-            string dir = Path.Combine(prefix, version);
-            if (!Directory.Exists(dir))
-            {
-                return;
-            }
-
-            foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
-            {
-                AddAssembly(assembly, package);
-                list.Add(assembly);
-            }
-
-            package.Initialize("mono",
-                               version,
-                               "The Mono runtime",
-                               list.ToArray(),
-                               ver,
-                               false);
-            packages.Add(package);
-        }
-
-        void RunInitialization()
-        {
-            string versionDir;
-
-            if (Environment.Version.Major == 1)
-            {
-                versionDir = "1.0";
-            }
-            else
-            {
-                versionDir = "2.0";
-            }
-
-            //Pull up assemblies from the installed mono system.
-            string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
-
-            if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
-                prefix = Path.Combine(prefix, "mono");
-            else
-                prefix = Path.GetDirectoryName(prefix);
-
-            RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
-            RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
-
-            string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
-            string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
-
-            if (String.IsNullOrEmpty(libpath))
-            {
-                string path_dirs = Environment.GetEnvironmentVariable("PATH");
-                foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
-                {
-                    if (pathdir == null)
-                        continue;
-                    if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
-                    {
-                        libpath = Path.Combine(pathdir, "..");
-                        libpath = Path.Combine(libpath, "lib");
-                        libpath = Path.Combine(libpath, "pkgconfig");
-                        break;
-                    }
-                }
-            }
-            search_dirs += Path.PathSeparator + libpath;
-            if (!string.IsNullOrEmpty(search_dirs))
-            {
-                List<string> scanDirs = new List<string>();
-                foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
-                {
-                    if (!scanDirs.Contains(potentialDir))
-                        scanDirs.Add(potentialDir);
-                }
-                foreach (string pcdir in scanDirs)
-                {
-                    if (pcdir == null)
-                        continue;
-
-                    if (Directory.Exists(pcdir))
-                    {
-                        foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
-                        {
-                            ParsePCFile(pcfile);
-                        }
-                    }
-                }
-            }
-        }
-
-        private void WriteCombine(SolutionNode solution)
-        {
-            #region "Create Solution directory if it doesn't exist"
-            string solutionDir = Path.Combine(solution.FullPath,
-                                              Path.Combine("autotools",
-                                                           solution.Name));
-            chkMkDir(solutionDir);
-            #endregion
-
-            #region "Write Solution-level files"
-            XsltArgumentList argList = new XsltArgumentList();
-            argList.AddParam("solutionName", "", solution.Name);
-            // $solutionDir is $rootDir/$solutionName/
-            transformToFile(Path.Combine(solutionDir, "configure.ac"),
-                            argList, "/Autotools/SolutionConfigureAc");
-            transformToFile(Path.Combine(solutionDir, "Makefile.am"),
-                            argList, "/Autotools/SolutionMakefileAm");
-            transformToFile(Path.Combine(solutionDir, "autogen.sh"),
-                            argList, "/Autotools/SolutionAutogenSh");
-            #endregion
-
-            foreach (ProjectNode project in solution.ProjectsTableOrder)
-            {
-              m_Kernel.Log.Write(String.Format("Writing project: {0}",
-                                               project.Name));
-              WriteProject(solution, project);
-            }
-        }
-
-        private static string FindFileReference(string refName,
-                                                ProjectNode project)
-        {
-            foreach (ReferencePathNode refPath in project.ReferencePaths)
-            {
-              string fullPath =
-                Helper.MakeFilePath(refPath.Path, refName, "dll");
-
-              if (File.Exists(fullPath)) {
-                return fullPath;
-              }
-            }
-
-            return null;
-        }
-
-        /// <summary>
-        /// Gets the XML doc file.
-        /// </summary>
-        /// <param name="project">The project.</param>
-        /// <param name="conf">The conf.</param>
-        /// <returns></returns>
-        public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
-        {
-            if (conf == null)
-            {
-                throw new ArgumentNullException("conf");
-            }
-            if (project == null)
-            {
-                throw new ArgumentNullException("project");
-            }
-            string docFile = (string)conf.Options["XmlDocFile"];
-            //			if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
-            //			{
-            //				return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
-            //			}
-            return docFile;
-        }
-
-        /// <summary>
-        /// Normalizes the path.
-        /// </summary>
-        /// <param name="path">The path.</param>
-        /// <returns></returns>
-        public static string NormalizePath(string path)
-        {
-            if (path == null)
-            {
-                return "";
-            }
-
-            StringBuilder tmpPath;
-
-            if (Core.Parse.Preprocessor.GetOS() == "Win32")
-            {
-                tmpPath = new StringBuilder(path.Replace('\\', '/'));
-                tmpPath.Replace("/", @"\\");
-            }
-            else
-            {
-                tmpPath = new StringBuilder(path.Replace('\\', '/'));
-                tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
-            }
-            return tmpPath.ToString();
-        }
-
-        private void WriteProject(SolutionNode solution, ProjectNode project)
-        {
-            string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
-            string projectDir = Path.Combine(solutionDir, project.Name);
-            string projectVersion = project.Version;
-            bool hasAssemblyConfig = false;
-            chkMkDir(projectDir);
-
-            List<string>
-                compiledFiles = new List<string>(),
-                contentFiles = new List<string>(),
-                embeddedFiles = new List<string>(),
-
-                binaryLibs = new List<string>(),
-                pkgLibs = new List<string>(),
-                systemLibs = new List<string>(),
-                runtimeLibs = new List<string>(),
-
-                extraDistFiles = new List<string>(),
-                localCopyTargets = new List<string>();
-
-            // If there exists a .config file for this assembly, copy
-            // it to the project folder
-
-            // TODO: Support copying .config.osx files
-            // TODO: support processing the .config file for native library deps
-            string projectAssemblyName = project.Name;
-            if (project.AssemblyName != null)
-                projectAssemblyName = project.AssemblyName;
-
-            if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
-            {
-                hasAssemblyConfig = true;
-                System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
-                extraDistFiles.Add(project.AssemblyName + ".dll.config");
-            }
-
-            foreach (ConfigurationNode conf in project.Configurations)
-            {
-                if (conf.Options.KeyFile != string.Empty)
-                {
-                    // Copy snk file into the project's directory
-                    // Use the snk from the project directory directly
-                    string source = Path.Combine(project.FullPath, conf.Options.KeyFile);
-                    string keyFile = conf.Options.KeyFile;
-                    Regex re = new Regex(".*/");
-                    keyFile = re.Replace(keyFile, "");
-
-                    string dest = Path.Combine(projectDir, keyFile);
-                    // Tell the user if there's a problem copying the file
-                    try
-                    {
-                        mkdirDashP(System.IO.Path.GetDirectoryName(dest));
-                        System.IO.File.Copy(source, dest, true);
-                    }
-                    catch (System.IO.IOException e)
-                    {
-                        Console.WriteLine(e.Message);
-                    }
-                }
-            }
-
-            // Copy compiled, embedded and content files into the project's directory
-            foreach (string filename in project.Files)
-            {
-                string source = Path.Combine(project.FullPath, filename);
-                string dest = Path.Combine(projectDir, filename);
-
-                if (filename.Contains("AssemblyInfo.cs"))
-                {
-                    // If we've got an AssemblyInfo.cs, pull the version number from it
-                    string[] sources = { source };
-                    string[] args = { "" };
-                    Microsoft.CSharp.CSharpCodeProvider cscp =
-                        new Microsoft.CSharp.CSharpCodeProvider();
-
-                    string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
-                    System.CodeDom.Compiler.CompilerParameters cparam =
-                        new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
-                    
-                    System.CodeDom.Compiler.CompilerResults cr =
-                        cscp.CompileAssemblyFromFile(cparam, sources);
-
-                    foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
-                        Console.WriteLine("Error! '{0}'", error.ErrorText);
-
-                    try {
-                      string projectFullName = cr.CompiledAssembly.FullName;
-                      Regex verRegex = new Regex("Version=([\\d\\.]+)");
-                      Match verMatch = verRegex.Match(projectFullName);
-                      if (verMatch.Success)
-                        projectVersion = verMatch.Groups[1].Value;
-                    }catch{
-                      Console.WriteLine("Couldn't compile AssemblyInfo.cs");
-                    }
-
-                    // Clean up the temp file
-                    try
-                    {
-                        if (File.Exists(tempAssemblyFile))
-                            File.Delete(tempAssemblyFile);
-                    }
-                    catch 
-                    {
-                        Console.WriteLine("Error! '{0}'", e);
-                    }
-                   
-                }
-
-                // Tell the user if there's a problem copying the file
-                try
-                {
-                    mkdirDashP(System.IO.Path.GetDirectoryName(dest));
-                    System.IO.File.Copy(source, dest, true);
-                }
-                catch (System.IO.IOException e)
-                {
-                    Console.WriteLine(e.Message);
-                }
-
-                switch (project.Files.GetBuildAction(filename))
-                {
-                    case BuildAction.Compile:
-                        compiledFiles.Add(filename);
-                        break;
-                    case BuildAction.Content:
-                        contentFiles.Add(filename);
-                        extraDistFiles.Add(filename);
-                        break;
-                    case BuildAction.EmbeddedResource:
-                        embeddedFiles.Add(filename);
-                        break;
-                }
-            }
-
-            // Set up references
-            for (int refNum = 0; refNum < project.References.Count; refNum++)
-            {
-                ReferenceNode refr = project.References[refNum];
-                Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
-
-                /* Determine which pkg-config (.pc) file refers to
-                   this assembly */
-
-                SystemPackage package = null;
-
-                if (packagesHash.ContainsKey(refr.Name))
-                {
-                  package = packagesHash[refr.Name];
-
-                }
-                else
-                {
-                    string assemblyFullName = string.Empty;
-                    if (refAssembly != null)
-                        assemblyFullName = refAssembly.FullName;
-
-                    string assemblyFileName = string.Empty;
-                    if (assemblyFullName != string.Empty &&
-                        assemblyFullNameToPath.ContainsKey(assemblyFullName)
-                        )
-                        assemblyFileName =
-                          assemblyFullNameToPath[assemblyFullName];
-
-                    if (assemblyFileName != string.Empty &&
-                        assemblyPathToPackage.ContainsKey(assemblyFileName)
-                        )
-                        package = assemblyPathToPackage[assemblyFileName];
-
-                }
-
-                /* If we know the .pc file and it is not "mono"
-                   (already in the path), add a -pkg: argument */
-
-                if (package != null &&
-                    package.Name != "mono" &&
-                    !pkgLibs.Contains(package.Name)
-                    )
-                    pkgLibs.Add(package.Name);
-
-                string fileRef =
-                  FindFileReference(refr.Name, (ProjectNode)refr.Parent);
-
-                if (refr.LocalCopy ||
-                    solution.ProjectsTable.ContainsKey(refr.Name) ||
-                    fileRef != null ||
-                    refr.Path != null
-                    )
-                {
-
-                    /* Attempt to copy the referenced lib to the
-                       project's directory */
-
-                    string filename = refr.Name + ".dll";
-                    string source = filename;
-                    if (refr.Path != null)
-                        source = Path.Combine(refr.Path, source);
-                    source = Path.Combine(project.FullPath, source);
-                    string dest = Path.Combine(projectDir, filename);
-
-                    /* Since we depend on this binary dll to build, we
-                     * will add a compile- time dependency on the
-                     * copied dll, and add the dll to the list of
-                     * files distributed with this package
-                     */
-
-                    binaryLibs.Add(refr.Name + ".dll");
-                    extraDistFiles.Add(refr.Name + ".dll");
-
-                    // TODO: Support copying .config.osx files
-                    // TODO: Support for determining native dependencies
-                    if (File.Exists(source + ".config"))
-                    {
-                        System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
-                        extraDistFiles.Add(refr.Name + ".dll.config");
-                    }
-
-                    try
-                    {
-                        System.IO.File.Copy(source, dest, true);
-                    }
-                    catch (System.IO.IOException)
-                    {
-                      if (solution.ProjectsTable.ContainsKey(refr.Name)){
-
-                        /* If an assembly is referenced, marked for
-                         * local copy, in the list of projects for
-                         * this solution, but does not exist, put a
-                         * target into the Makefile.am to build the
-                         * assembly and copy it to this project's
-                         * directory
-                         */
-
-                        ProjectNode sourcePrj =
-                          ((solution.ProjectsTable[refr.Name]));
-
-                        string target =
-                          String.Format("{0}:\n" +
-                                        "\t$(MAKE) -C ../{1}\n" +
-                                        "\tln ../{2}/$@ $@\n",
-                                        filename,
-                                        sourcePrj.Name,
-                                        sourcePrj.Name );
-
-                        localCopyTargets.Add(target);
-                      }
-                    }
-                }
-                else if( !pkgLibs.Contains(refr.Name) )
-                {
-                    // Else, let's assume it's in the GAC or the lib path
-                    string assemName = string.Empty;
-                    int index = refr.Name.IndexOf(",");
-
-                    if (index > 0)
-                        assemName = refr.Name.Substring(0, index);
-                    else
-                        assemName = refr.Name;
-
-                    m_Kernel.Log.Write(String.Format(
-                    "Warning: Couldn't find an appropriate assembly " +
-                    "for reference:\n'{0}'", refr.Name
-                                                     ));
-                    systemLibs.Add(assemName);
-                }
-            }
-
-            const string lineSep = " \\\n\t";
-            string compiledFilesString = string.Empty;
-            if (compiledFiles.Count > 0)
-                compiledFilesString =
-                    lineSep + string.Join(lineSep, compiledFiles.ToArray());
-
-            string embeddedFilesString = "";
-            if (embeddedFiles.Count > 0)
-                embeddedFilesString =
-                    lineSep + string.Join(lineSep, embeddedFiles.ToArray());
-
-            string contentFilesString = "";
-            if (contentFiles.Count > 0)
-                contentFilesString =
-                    lineSep + string.Join(lineSep, contentFiles.ToArray());
-
-            string extraDistFilesString = "";
-            if (extraDistFiles.Count > 0)
-                extraDistFilesString =
-                    lineSep + string.Join(lineSep, extraDistFiles.ToArray());
-
-            string pkgLibsString = "";
-            if (pkgLibs.Count > 0)
-                pkgLibsString =
-                    lineSep + string.Join(lineSep, pkgLibs.ToArray());
-
-            string binaryLibsString = "";
-            if (binaryLibs.Count > 0)
-                binaryLibsString =
-                    lineSep + string.Join(lineSep, binaryLibs.ToArray());
-
-            string systemLibsString = "";
-            if (systemLibs.Count > 0)
-                systemLibsString =
-                    lineSep + string.Join(lineSep, systemLibs.ToArray());
-
-            string localCopyTargetsString = "";
-            if (localCopyTargets.Count > 0)
-                localCopyTargetsString =
-                    string.Join("\n", localCopyTargets.ToArray());
-
-            string monoPath = "";
-            foreach (string runtimeLib in runtimeLibs)
-            {
-                monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
-            }
-
-            // Add the project name to the list of transformation
-            // parameters
-            XsltArgumentList argList = new XsltArgumentList();
-            argList.AddParam("projectName", "", project.Name);
-            argList.AddParam("solutionName", "", solution.Name);
-            argList.AddParam("assemblyName", "", projectAssemblyName);
-            argList.AddParam("compiledFiles", "", compiledFilesString);
-            argList.AddParam("embeddedFiles", "", embeddedFilesString);
-            argList.AddParam("contentFiles", "", contentFilesString);
-            argList.AddParam("extraDistFiles", "", extraDistFilesString);
-            argList.AddParam("pkgLibs", "", pkgLibsString);
-            argList.AddParam("binaryLibs", "", binaryLibsString);
-            argList.AddParam("systemLibs", "", systemLibsString);
-            argList.AddParam("monoPath", "", monoPath);
-            argList.AddParam("localCopyTargets", "", localCopyTargetsString);
-            argList.AddParam("projectVersion", "", projectVersion);
-            argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
-
-            // Transform the templates
-            transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
-            transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
-            transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
-
-            if (project.Type == Core.Nodes.ProjectType.Library)
-                transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
-            if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe)
-                transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
-        }
-
-        private void CleanProject(ProjectNode project)
-        {
-            m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
-            string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
-            Helper.DeleteIfExists(projectFile);
-        }
-
-        private void CleanSolution(SolutionNode solution)
-        {
-            m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
-
-            string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
-            Helper.DeleteIfExists(slnFile);
-
-            foreach (ProjectNode project in solution.Projects)
-            {
-                CleanProject(project);
-            }
-
-            m_Kernel.Log.Write("");
-        }
-
-        #endregion
-
-        #region ITarget Members
-
-        /// <summary>
-        /// Writes the specified kern.
-        /// </summary>
-        /// <param name="kern">The kern.</param>
-        public void Write(Kernel kern)
-        {
-            if (kern == null)
-            {
-                throw new ArgumentNullException("kern");
-            }
-            m_Kernel = kern;
-            m_Kernel.Log.Write("Parsing system pkg-config files");
-            RunInitialization();
-
-            const string streamName = "autotools.xml";
-            string fqStreamName = String.Format("Prebuild.data.{0}",
-                                                streamName
-                                                );
-
-            // Retrieve stream for the autotools template XML
-            Stream autotoolsStream = Assembly.GetExecutingAssembly()
-                .GetManifestResourceStream(fqStreamName);
-
-            if(autotoolsStream == null) {
-
-              /* 
-               * try without the default namespace prepended, in
-               * case prebuild.exe assembly was compiled with
-               * something other than Visual Studio .NET
-               */
-
-              autotoolsStream = Assembly.GetExecutingAssembly()
-                .GetManifestResourceStream(streamName);
-              if(autotoolsStream == null){
-                string errStr =
-                  String.Format("Could not find embedded resource file:\n" +
-                                "'{0}' or '{1}'",
-                                streamName, fqStreamName
-                                );
-
-                m_Kernel.Log.Write(errStr);
-
-                throw new System.Reflection.TargetException(errStr);
-              }
-            }
-
-            // Create an XML URL Resolver with default credentials
-            xr = new System.Xml.XmlUrlResolver();
-            xr.Credentials = CredentialCache.DefaultCredentials;
-
-            // Create a default evidence - no need to limit access
-            e = new System.Security.Policy.Evidence();
-
-            // Load the autotools XML
-            autotoolsDoc = new XmlDocument();
-            autotoolsDoc.Load(autotoolsStream);
-
-            /* rootDir is the filesystem location where the Autotools
-             * build tree will be created - for now we'll make it
-             * $PWD/autotools
-             */
-
-            string pwd = Directory.GetCurrentDirectory();
-            //string pwd = System.Environment.GetEnvironmentVariable("PWD");
-            //if (pwd.Length != 0)
-            //{
-            string rootDir = Path.Combine(pwd, "autotools");
-            //}
-            //else
-            //{
-            //    pwd = Assembly.GetExecutingAssembly()
-            //}
-            chkMkDir(rootDir);
-
-            foreach (SolutionNode solution in kern.Solutions)
-            {
-              m_Kernel.Log.Write(String.Format("Writing solution: {0}",
-                                        solution.Name));
-              WriteCombine(solution);
-            }
-            m_Kernel = null;
-        }
-
-        /// <summary>
-        /// Cleans the specified kern.
-        /// </summary>
-        /// <param name="kern">The kern.</param>
-        public virtual void Clean(Kernel kern)
-        {
-            if (kern == null)
-            {
-                throw new ArgumentNullException("kern");
-            }
-            m_Kernel = kern;
-            foreach (SolutionNode sol in kern.Solutions)
-            {
-                CleanSolution(sol);
-            }
-            m_Kernel = null;
-        }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name
-        {
-            get
-            {
-                return "autotools";
-            }
-        }
-
-        #endregion
-    }
-}
+#region BSD License
+/*
+
+Copyright (c) 2004 - 2008
+Matthew Holmes        ([email protected]),
+Dan     Moorehead     ([email protected]),
+Dave    Hudson        ([email protected]),
+C.J.    Adams-Collier ([email protected]),
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+* The name of the author may not be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+#endregion
+
+#region MIT X11 license
+
+/*
+ Portions of this file authored by Lluis Sanchez Gual
+
+ Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+ 
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#endregion
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Net;
+using System.Diagnostics;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+    public enum ClrVersion
+    {
+        Default,
+        Net_1_1,
+        Net_2_0
+    }
+
+    public class SystemPackage
+    {
+        string name;
+        string version;
+        string description;
+        string[] assemblies;
+        bool isInternal;
+        ClrVersion targetVersion;
+
+        public void Initialize(string name,
+                               string version,
+                               string description,
+                               string[] assemblies,
+                               ClrVersion targetVersion,
+                               bool isInternal)
+        {
+            this.isInternal = isInternal;
+            this.name = name;
+            this.version = version;
+            this.assemblies = assemblies;
+            this.description = description;
+            this.targetVersion = targetVersion;
+        }
+
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public string Version
+        {
+            get { return version; }
+        }
+
+        public string Description
+        {
+            get { return description; }
+        }
+
+        public ClrVersion TargetVersion
+        {
+            get { return targetVersion; }
+        }
+
+        // The package is part of the mono SDK
+        public bool IsCorePackage
+        {
+            get { return name == "mono"; }
+        }
+
+        // The package has been registered by an add-in, and is not installed
+        // in the system.
+        public bool IsInternalPackage
+        {
+            get { return isInternal; }
+        }
+
+        public string[] Assemblies
+        {
+            get { return assemblies; }
+        }
+
+    }
+
+
+    /// <summary>
+    /// 
+    /// </summary>
+    [Target("autotools")]
+    public class AutotoolsTarget : ITarget
+    {
+        #region Fields
+
+        Kernel m_Kernel;
+        XmlDocument autotoolsDoc;
+        XmlUrlResolver xr;
+        System.Security.Policy.Evidence e;
+        readonly Dictionary<string, SystemPackage> assemblyPathToPackage = new Dictionary<string, SystemPackage>();
+        readonly Dictionary<string, string> assemblyFullNameToPath = new Dictionary<string, string>();
+        readonly Dictionary<string, SystemPackage> packagesHash = new Dictionary<string, SystemPackage>();
+        readonly List<SystemPackage> packages = new List<SystemPackage>();
+
+        #endregion
+
+        #region Private Methods
+
+        private static void mkdirDashP(string dirName)
+        {
+            DirectoryInfo di = new DirectoryInfo(dirName);
+            if (di.Exists)
+                return;
+
+            string parentDirName = System.IO.Path.GetDirectoryName(dirName);
+            DirectoryInfo parentDi = new DirectoryInfo(parentDirName);
+            if (!parentDi.Exists)
+                mkdirDashP(parentDirName);
+
+            di.Create();
+        }
+
+        private static void chkMkDir(string dirName)
+        {
+            System.IO.DirectoryInfo di =
+                new System.IO.DirectoryInfo(dirName);
+
+            if (!di.Exists)
+                di.Create();
+        }
+
+        private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
+        {
+            // Create an XslTransform for this file
+            XslTransform templateTransformer =
+                new XslTransform();
+
+            // Load up the template
+            XmlNode templateNode =
+                autotoolsDoc.SelectSingleNode(nodeName + "/*");
+            templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
+
+            // Create a writer for the transformed template
+            XmlTextWriter templateWriter =
+                new XmlTextWriter(filename, null);
+
+            // Perform transformation, writing the file
+            templateTransformer.Transform
+                (m_Kernel.CurrentDoc, argList, templateWriter, xr);
+        }
+
+        static string NormalizeAsmName(string name)
+        {
+            int i = name.IndexOf(", PublicKeyToken=null");
+            if (i != -1)
+                return name.Substring(0, i).Trim();
+            return name;
+        }
+
+        private void AddAssembly(string assemblyfile, SystemPackage package)
+        {
+            if (!File.Exists(assemblyfile))
+                return;
+
+            try
+            {
+                System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile);
+                assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
+                assemblyPathToPackage[assemblyfile] = package;
+            }
+            catch
+            {
+            }
+        }
+
+        private static List<string> GetAssembliesWithLibInfo(string line, string file)
+        {
+            List<string> references = new List<string>();
+            List<string> libdirs = new List<string>();
+            List<string> retval = new List<string>();
+            foreach (string piece in line.Split(' '))
+            {
+                if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
+                {
+                    references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
+                }
+                else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
+                {
+                    libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
+                }
+            }
+
+            foreach (string refrnc in references)
+            {
+                foreach (string libdir in libdirs)
+                {
+                    if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
+                    {
+                        retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
+                    }
+                }
+            }
+
+            return retval;
+        }
+
+        private static List<string> GetAssembliesWithoutLibInfo(string line, string file)
+        {
+            List<string> references = new List<string>();
+            foreach (string reference in line.Split(' '))
+            {
+                if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
+                {
+                    string final_ref = reference.Substring(3).Trim();
+                    references.Add(ProcessPiece(final_ref, file));
+                }
+            }
+            return references;
+        }
+
+        private static string ProcessPiece(string piece, string pcfile)
+        {
+            int start = piece.IndexOf("${");
+            if (start == -1)
+                return piece;
+
+            int end = piece.IndexOf("}");
+            if (end == -1)
+                return piece;
+
+            string variable = piece.Substring(start + 2, end - start - 2);
+            string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
+            return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
+        }
+
+        private static string GetVariableFromPkgConfig(string var, string pcfile)
+        {
+            ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
+            psi.RedirectStandardOutput = true;
+            psi.UseShellExecute = false;
+            psi.Arguments = String.Format("--variable={0} {1}", var, pcfile);
+            Process p = new Process();
+            p.StartInfo = psi;
+            p.Start();
+            string ret = p.StandardOutput.ReadToEnd().Trim();
+            p.WaitForExit();
+            if (String.IsNullOrEmpty(ret))
+                return String.Empty;
+            return ret;
+        }
+
+        private void ParsePCFile(string pcfile)
+        {
+            // Don't register the package twice
+            string pname = Path.GetFileNameWithoutExtension(pcfile);
+            if (packagesHash.ContainsKey(pname))
+                return;
+
+            List<string> fullassemblies = null;
+            string version = "";
+            string desc = "";
+
+            SystemPackage package = new SystemPackage();
+
+            using (StreamReader reader = new StreamReader(pcfile))
+            {
+                string line;
+                while ((line = reader.ReadLine()) != null)
+                {
+                    string lowerLine = line.ToLower();
+                    if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
+                    {
+                        string choppedLine = line.Substring(5).Trim();
+                        if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
+                        {
+                            fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
+                        }
+                        else
+                        {
+                            fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
+                        }
+                    }
+                    else if (lowerLine.StartsWith("version:"))
+                    {
+                        // "version:".Length == 8
+                        version = line.Substring(8).Trim();
+                    }
+                    else if (lowerLine.StartsWith("description:"))
+                    {
+                        // "description:".Length == 12
+                        desc = line.Substring(12).Trim();
+                    }
+                }
+            }
+
+            if (fullassemblies == null)
+                return;
+
+            foreach (string assembly in fullassemblies)
+            {
+                AddAssembly(assembly, package);
+            }
+
+            package.Initialize(pname,
+                               version,
+                               desc,
+                               fullassemblies.ToArray(),
+                               ClrVersion.Default,
+                               false);
+            packages.Add(package);
+            packagesHash[pname] = package;
+        }
+
+        void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
+        {
+            SystemPackage package = new SystemPackage();
+            List<string> list = new List<string>();
+
+            string dir = Path.Combine(prefix, version);
+            if (!Directory.Exists(dir))
+            {
+                return;
+            }
+
+            foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
+            {
+                AddAssembly(assembly, package);
+                list.Add(assembly);
+            }
+
+            package.Initialize("mono",
+                               version,
+                               "The Mono runtime",
+                               list.ToArray(),
+                               ver,
+                               false);
+            packages.Add(package);
+        }
+
+        void RunInitialization()
+        {
+            string versionDir;
+
+            if (Environment.Version.Major == 1)
+            {
+                versionDir = "1.0";
+            }
+            else
+            {
+                versionDir = "2.0";
+            }
+
+            //Pull up assemblies from the installed mono system.
+            string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
+
+            if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
+                prefix = Path.Combine(prefix, "mono");
+            else
+                prefix = Path.GetDirectoryName(prefix);
+
+            RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
+            RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
+
+            string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
+            string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
+
+            if (String.IsNullOrEmpty(libpath))
+            {
+                string path_dirs = Environment.GetEnvironmentVariable("PATH");
+                foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
+                {
+                    if (pathdir == null)
+                        continue;
+                    if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
+                    {
+                        libpath = Path.Combine(pathdir, "..");
+                        libpath = Path.Combine(libpath, "lib");
+                        libpath = Path.Combine(libpath, "pkgconfig");
+                        break;
+                    }
+                }
+            }
+            search_dirs += Path.PathSeparator + libpath;
+            if (!string.IsNullOrEmpty(search_dirs))
+            {
+                List<string> scanDirs = new List<string>();
+                foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
+                {
+                    if (!scanDirs.Contains(potentialDir))
+                        scanDirs.Add(potentialDir);
+                }
+                foreach (string pcdir in scanDirs)
+                {
+                    if (pcdir == null)
+                        continue;
+
+                    if (Directory.Exists(pcdir))
+                    {
+                        foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
+                        {
+                            ParsePCFile(pcfile);
+                        }
+                    }
+                }
+            }
+        }
+
+        private void WriteCombine(SolutionNode solution)
+        {
+            #region "Create Solution directory if it doesn't exist"
+            string solutionDir = Path.Combine(solution.FullPath,
+                                              Path.Combine("autotools",
+                                                           solution.Name));
+            chkMkDir(solutionDir);
+            #endregion
+
+            #region "Write Solution-level files"
+            XsltArgumentList argList = new XsltArgumentList();
+            argList.AddParam("solutionName", "", solution.Name);
+            // $solutionDir is $rootDir/$solutionName/
+            transformToFile(Path.Combine(solutionDir, "configure.ac"),
+                            argList, "/Autotools/SolutionConfigureAc");
+            transformToFile(Path.Combine(solutionDir, "Makefile.am"),
+                            argList, "/Autotools/SolutionMakefileAm");
+            transformToFile(Path.Combine(solutionDir, "autogen.sh"),
+                            argList, "/Autotools/SolutionAutogenSh");
+            #endregion
+
+            foreach (ProjectNode project in solution.ProjectsTableOrder)
+            {
+              m_Kernel.Log.Write(String.Format("Writing project: {0}",
+                                               project.Name));
+              WriteProject(solution, project);
+            }
+        }
+
+        private static string FindFileReference(string refName,
+                                                ProjectNode project)
+        {
+            foreach (ReferencePathNode refPath in project.ReferencePaths)
+            {
+              string fullPath =
+                Helper.MakeFilePath(refPath.Path, refName, "dll");
+
+              if (File.Exists(fullPath)) {
+                return fullPath;
+              }
+            }
+
+            return null;
+        }
+
+        /// <summary>
+        /// Gets the XML doc file.
+        /// </summary>
+        /// <param name="project">The project.</param>
+        /// <param name="conf">The conf.</param>
+        /// <returns></returns>
+        public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
+        {
+            if (conf == null)
+            {
+                throw new ArgumentNullException("conf");
+            }
+            if (project == null)
+            {
+                throw new ArgumentNullException("project");
+            }
+            string docFile = (string)conf.Options["XmlDocFile"];
+            //			if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
+            //			{
+            //				return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
+            //			}
+            return docFile;
+        }
+
+        /// <summary>
+        /// Normalizes the path.
+        /// </summary>
+        /// <param name="path">The path.</param>
+        /// <returns></returns>
+        public static string NormalizePath(string path)
+        {
+            if (path == null)
+            {
+                return "";
+            }
+
+            StringBuilder tmpPath;
+
+            if (Core.Parse.Preprocessor.GetOS() == "Win32")
+            {
+                tmpPath = new StringBuilder(path.Replace('\\', '/'));
+                tmpPath.Replace("/", @"\\");
+            }
+            else
+            {
+                tmpPath = new StringBuilder(path.Replace('\\', '/'));
+                tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
+            }
+            return tmpPath.ToString();
+        }
+
+        private void WriteProject(SolutionNode solution, ProjectNode project)
+        {
+            string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
+            string projectDir = Path.Combine(solutionDir, project.Name);
+            string projectVersion = project.Version;
+            bool hasAssemblyConfig = false;
+            chkMkDir(projectDir);
+
+            List<string>
+                compiledFiles = new List<string>(),
+                contentFiles = new List<string>(),
+                embeddedFiles = new List<string>(),
+
+                binaryLibs = new List<string>(),
+                pkgLibs = new List<string>(),
+                systemLibs = new List<string>(),
+                runtimeLibs = new List<string>(),
+
+                extraDistFiles = new List<string>(),
+                localCopyTargets = new List<string>();
+
+            // If there exists a .config file for this assembly, copy
+            // it to the project folder
+
+            // TODO: Support copying .config.osx files
+            // TODO: support processing the .config file for native library deps
+            string projectAssemblyName = project.Name;
+            if (project.AssemblyName != null)
+                projectAssemblyName = project.AssemblyName;
+
+            if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
+            {
+                hasAssemblyConfig = true;
+                System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
+                extraDistFiles.Add(project.AssemblyName + ".dll.config");
+            }
+
+            foreach (ConfigurationNode conf in project.Configurations)
+            {
+                if (conf.Options.KeyFile != string.Empty)
+                {
+                    // Copy snk file into the project's directory
+                    // Use the snk from the project directory directly
+                    string source = Path.Combine(project.FullPath, conf.Options.KeyFile);
+                    string keyFile = conf.Options.KeyFile;
+                    Regex re = new Regex(".*/");
+                    keyFile = re.Replace(keyFile, "");
+
+                    string dest = Path.Combine(projectDir, keyFile);
+                    // Tell the user if there's a problem copying the file
+                    try
+                    {
+                        mkdirDashP(System.IO.Path.GetDirectoryName(dest));
+                        System.IO.File.Copy(source, dest, true);
+                    }
+                    catch (System.IO.IOException e)
+                    {
+                        Console.WriteLine(e.Message);
+                    }
+                }
+            }
+
+            // Copy compiled, embedded and content files into the project's directory
+            foreach (string filename in project.Files)
+            {
+                string source = Path.Combine(project.FullPath, filename);
+                string dest = Path.Combine(projectDir, filename);
+
+                if (filename.Contains("AssemblyInfo.cs"))
+                {
+                    // If we've got an AssemblyInfo.cs, pull the version number from it
+                    string[] sources = { source };
+                    string[] args = { "" };
+                    Microsoft.CSharp.CSharpCodeProvider cscp =
+                        new Microsoft.CSharp.CSharpCodeProvider();
+
+                    string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
+                    System.CodeDom.Compiler.CompilerParameters cparam =
+                        new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
+                    
+                    System.CodeDom.Compiler.CompilerResults cr =
+                        cscp.CompileAssemblyFromFile(cparam, sources);
+
+                    foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
+                        Console.WriteLine("Error! '{0}'", error.ErrorText);
+
+                    try {
+                      string projectFullName = cr.CompiledAssembly.FullName;
+                      Regex verRegex = new Regex("Version=([\\d\\.]+)");
+                      Match verMatch = verRegex.Match(projectFullName);
+                      if (verMatch.Success)
+                        projectVersion = verMatch.Groups[1].Value;
+                    }catch{
+                      Console.WriteLine("Couldn't compile AssemblyInfo.cs");
+                    }
+
+                    // Clean up the temp file
+                    try
+                    {
+                        if (File.Exists(tempAssemblyFile))
+                            File.Delete(tempAssemblyFile);
+                    }
+                    catch 
+                    {
+                        Console.WriteLine("Error! '{0}'", e);
+                    }
+                   
+                }
+
+                // Tell the user if there's a problem copying the file
+                try
+                {
+                    mkdirDashP(System.IO.Path.GetDirectoryName(dest));
+                    System.IO.File.Copy(source, dest, true);
+                }
+                catch (System.IO.IOException e)
+                {
+                    Console.WriteLine(e.Message);
+                }
+
+                switch (project.Files.GetBuildAction(filename))
+                {
+                    case BuildAction.Compile:
+                        compiledFiles.Add(filename);
+                        break;
+                    case BuildAction.Content:
+                        contentFiles.Add(filename);
+                        extraDistFiles.Add(filename);
+                        break;
+                    case BuildAction.EmbeddedResource:
+                        embeddedFiles.Add(filename);
+                        break;
+                }
+            }
+
+            // Set up references
+            for (int refNum = 0; refNum < project.References.Count; refNum++)
+            {
+                ReferenceNode refr = project.References[refNum];
+                Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
+
+                /* Determine which pkg-config (.pc) file refers to
+                   this assembly */
+
+                SystemPackage package = null;
+
+                if (packagesHash.ContainsKey(refr.Name))
+                {
+                  package = packagesHash[refr.Name];
+
+                }
+                else
+                {
+                    string assemblyFullName = string.Empty;
+                    if (refAssembly != null)
+                        assemblyFullName = refAssembly.FullName;
+
+                    string assemblyFileName = string.Empty;
+                    if (assemblyFullName != string.Empty &&
+                        assemblyFullNameToPath.ContainsKey(assemblyFullName)
+                        )
+                        assemblyFileName =
+                          assemblyFullNameToPath[assemblyFullName];
+
+                    if (assemblyFileName != string.Empty &&
+                        assemblyPathToPackage.ContainsKey(assemblyFileName)
+                        )
+                        package = assemblyPathToPackage[assemblyFileName];
+
+                }
+
+                /* If we know the .pc file and it is not "mono"
+                   (already in the path), add a -pkg: argument */
+
+                if (package != null &&
+                    package.Name != "mono" &&
+                    !pkgLibs.Contains(package.Name)
+                    )
+                    pkgLibs.Add(package.Name);
+
+                string fileRef =
+                  FindFileReference(refr.Name, (ProjectNode)refr.Parent);
+
+                if (refr.LocalCopy ||
+                    solution.ProjectsTable.ContainsKey(refr.Name) ||
+                    fileRef != null ||
+                    refr.Path != null
+                    )
+                {
+
+                    /* Attempt to copy the referenced lib to the
+                       project's directory */
+
+                    string filename = refr.Name + ".dll";
+                    string source = filename;
+                    if (refr.Path != null)
+                        source = Path.Combine(refr.Path, source);
+                    source = Path.Combine(project.FullPath, source);
+                    string dest = Path.Combine(projectDir, filename);
+
+                    /* Since we depend on this binary dll to build, we
+                     * will add a compile- time dependency on the
+                     * copied dll, and add the dll to the list of
+                     * files distributed with this package
+                     */
+
+                    binaryLibs.Add(refr.Name + ".dll");
+                    extraDistFiles.Add(refr.Name + ".dll");
+
+                    // TODO: Support copying .config.osx files
+                    // TODO: Support for determining native dependencies
+                    if (File.Exists(source + ".config"))
+                    {
+                        System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
+                        extraDistFiles.Add(refr.Name + ".dll.config");
+                    }
+
+                    try
+                    {
+                        System.IO.File.Copy(source, dest, true);
+                    }
+                    catch (System.IO.IOException)
+                    {
+                      if (solution.ProjectsTable.ContainsKey(refr.Name)){
+
+                        /* If an assembly is referenced, marked for
+                         * local copy, in the list of projects for
+                         * this solution, but does not exist, put a
+                         * target into the Makefile.am to build the
+                         * assembly and copy it to this project's
+                         * directory
+                         */
+
+                        ProjectNode sourcePrj =
+                          ((solution.ProjectsTable[refr.Name]));
+
+                        string target =
+                          String.Format("{0}:\n" +
+                                        "\t$(MAKE) -C ../{1}\n" +
+                                        "\tln ../{2}/$@ $@\n",
+                                        filename,
+                                        sourcePrj.Name,
+                                        sourcePrj.Name );
+
+                        localCopyTargets.Add(target);
+                      }
+                    }
+                }
+                else if( !pkgLibs.Contains(refr.Name) )
+                {
+                    // Else, let's assume it's in the GAC or the lib path
+                    string assemName = string.Empty;
+                    int index = refr.Name.IndexOf(",");
+
+                    if (index > 0)
+                        assemName = refr.Name.Substring(0, index);
+                    else
+                        assemName = refr.Name;
+
+                    m_Kernel.Log.Write(String.Format(
+                    "Warning: Couldn't find an appropriate assembly " +
+                    "for reference:\n'{0}'", refr.Name
+                                                     ));
+                    systemLibs.Add(assemName);
+                }
+            }
+
+            const string lineSep = " \\\n\t";
+            string compiledFilesString = string.Empty;
+            if (compiledFiles.Count > 0)
+                compiledFilesString =
+                    lineSep + string.Join(lineSep, compiledFiles.ToArray());
+
+            string embeddedFilesString = "";
+            if (embeddedFiles.Count > 0)
+                embeddedFilesString =
+                    lineSep + string.Join(lineSep, embeddedFiles.ToArray());
+
+            string contentFilesString = "";
+            if (contentFiles.Count > 0)
+                contentFilesString =
+                    lineSep + string.Join(lineSep, contentFiles.ToArray());
+
+            string extraDistFilesString = "";
+            if (extraDistFiles.Count > 0)
+                extraDistFilesString =
+                    lineSep + string.Join(lineSep, extraDistFiles.ToArray());
+
+            string pkgLibsString = "";
+            if (pkgLibs.Count > 0)
+                pkgLibsString =
+                    lineSep + string.Join(lineSep, pkgLibs.ToArray());
+
+            string binaryLibsString = "";
+            if (binaryLibs.Count > 0)
+                binaryLibsString =
+                    lineSep + string.Join(lineSep, binaryLibs.ToArray());
+
+            string systemLibsString = "";
+            if (systemLibs.Count > 0)
+                systemLibsString =
+                    lineSep + string.Join(lineSep, systemLibs.ToArray());
+
+            string localCopyTargetsString = "";
+            if (localCopyTargets.Count > 0)
+                localCopyTargetsString =
+                    string.Join("\n", localCopyTargets.ToArray());
+
+            string monoPath = "";
+            foreach (string runtimeLib in runtimeLibs)
+            {
+                monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
+            }
+
+            // Add the project name to the list of transformation
+            // parameters
+            XsltArgumentList argList = new XsltArgumentList();
+            argList.AddParam("projectName", "", project.Name);
+            argList.AddParam("solutionName", "", solution.Name);
+            argList.AddParam("assemblyName", "", projectAssemblyName);
+            argList.AddParam("compiledFiles", "", compiledFilesString);
+            argList.AddParam("embeddedFiles", "", embeddedFilesString);
+            argList.AddParam("contentFiles", "", contentFilesString);
+            argList.AddParam("extraDistFiles", "", extraDistFilesString);
+            argList.AddParam("pkgLibs", "", pkgLibsString);
+            argList.AddParam("binaryLibs", "", binaryLibsString);
+            argList.AddParam("systemLibs", "", systemLibsString);
+            argList.AddParam("monoPath", "", monoPath);
+            argList.AddParam("localCopyTargets", "", localCopyTargetsString);
+            argList.AddParam("projectVersion", "", projectVersion);
+            argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
+
+            // Transform the templates
+            transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
+            transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
+            transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
+
+            if (project.Type == Core.Nodes.ProjectType.Library)
+                transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
+            if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe)
+                transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
+        }
+
+        private void CleanProject(ProjectNode project)
+        {
+            m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+            string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
+            Helper.DeleteIfExists(projectFile);
+        }
+
+        private void CleanSolution(SolutionNode solution)
+        {
+            m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
+
+            string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
+            Helper.DeleteIfExists(slnFile);
+
+            foreach (ProjectNode project in solution.Projects)
+            {
+                CleanProject(project);
+            }
+
+            m_Kernel.Log.Write("");
+        }
+
+        #endregion
+
+        #region ITarget Members
+
+        /// <summary>
+        /// Writes the specified kern.
+        /// </summary>
+        /// <param name="kern">The kern.</param>
+        public void Write(Kernel kern)
+        {
+            if (kern == null)
+            {
+                throw new ArgumentNullException("kern");
+            }
+            m_Kernel = kern;
+            m_Kernel.Log.Write("Parsing system pkg-config files");
+            RunInitialization();
+
+            const string streamName = "autotools.xml";
+            string fqStreamName = String.Format("Prebuild.data.{0}",
+                                                streamName
+                                                );
+
+            // Retrieve stream for the autotools template XML
+            Stream autotoolsStream = Assembly.GetExecutingAssembly()
+                .GetManifestResourceStream(fqStreamName);
+
+            if(autotoolsStream == null) {
+
+              /* 
+               * try without the default namespace prepended, in
+               * case prebuild.exe assembly was compiled with
+               * something other than Visual Studio .NET
+               */
+
+              autotoolsStream = Assembly.GetExecutingAssembly()
+                .GetManifestResourceStream(streamName);
+              if(autotoolsStream == null){
+                string errStr =
+                  String.Format("Could not find embedded resource file:\n" +
+                                "'{0}' or '{1}'",
+                                streamName, fqStreamName
+                                );
+
+                m_Kernel.Log.Write(errStr);
+
+                throw new System.Reflection.TargetException(errStr);
+              }
+            }
+
+            // Create an XML URL Resolver with default credentials
+            xr = new System.Xml.XmlUrlResolver();
+            xr.Credentials = CredentialCache.DefaultCredentials;
+
+            // Create a default evidence - no need to limit access
+            e = new System.Security.Policy.Evidence();
+
+            // Load the autotools XML
+            autotoolsDoc = new XmlDocument();
+            autotoolsDoc.Load(autotoolsStream);
+
+            /* rootDir is the filesystem location where the Autotools
+             * build tree will be created - for now we'll make it
+             * $PWD/autotools
+             */
+
+            string pwd = Directory.GetCurrentDirectory();
+            //string pwd = System.Environment.GetEnvironmentVariable("PWD");
+            //if (pwd.Length != 0)
+            //{
+            string rootDir = Path.Combine(pwd, "autotools");
+            //}
+            //else
+            //{
+            //    pwd = Assembly.GetExecutingAssembly()
+            //}
+            chkMkDir(rootDir);
+
+            foreach (SolutionNode solution in kern.Solutions)
+            {
+              m_Kernel.Log.Write(String.Format("Writing solution: {0}",
+                                        solution.Name));
+              WriteCombine(solution);
+            }
+            m_Kernel = null;
+        }
+
+        /// <summary>
+        /// Cleans the specified kern.
+        /// </summary>
+        /// <param name="kern">The kern.</param>
+        public virtual void Clean(Kernel kern)
+        {
+            if (kern == null)
+            {
+                throw new ArgumentNullException("kern");
+            }
+            m_Kernel = kern;
+            foreach (SolutionNode sol in kern.Solutions)
+            {
+                CleanSolution(sol);
+            }
+            m_Kernel = null;
+        }
+
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name
+        {
+            get
+            {
+                return "autotools";
+            }
+        }
+
+        #endregion
+    }
+}

+ 138 - 138
Prebuild/src/Core/Targets/.svn/text-base/VS2010Target.cs.svn-base

@@ -1,138 +1,138 @@
-using System;
-using System.IO;
-using System.Text;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-using System.CodeDom.Compiler;
-
-namespace Prebuild.Core.Targets
-{
-
-	/// <summary>
-	/// 
-	/// </summary>
-	[Target("vs2010")]
-	public class VS2010Target : VSGenericTarget
-	{
-		#region Fields
-		
-		string solutionVersion = "11.00";
-		string productVersion = "9.0.30729";
-		string schemaVersion = "2.0";
-		string versionName = "Visual Studio 2010";
-		string name = "vs2010";
-		VSVersion version = VSVersion.VS10;
-
-		#endregion
-		
-		#region Properties
-		
-		/// <summary>
-		/// Gets or sets the solution version.
-		/// </summary>
-		/// <value>The solution version.</value>
-		public override string SolutionVersion
-		{
-			get
-			{
-				return solutionVersion;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the product version.
-		/// </summary>
-		/// <value>The product version.</value>
-		public override string ProductVersion
-		{
-			get
-			{
-				return productVersion;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the schema version.
-		/// </summary>
-		/// <value>The schema version.</value>
-		public override string SchemaVersion
-		{
-			get
-			{
-				return schemaVersion;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the name of the version.
-		/// </summary>
-		/// <value>The name of the version.</value>
-		public override string VersionName
-		{
-			get
-			{
-				return versionName;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the version.
-		/// </summary>
-		/// <value>The version.</value>
-		public override VSVersion Version
-		{
-			get
-			{
-				return version;
-			}
-		}
-		
-		/// <summary>
-		/// Gets the name.
-		/// </summary>
-		/// <value>The name.</value>
-		public override string Name
-		{
-			get
-			{
-				return name;
-			}
-		}
-
-        protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
-        {
-            switch (frameworkVersion)
-            {
-            	case FrameworkVersion.v4_0:
-                case FrameworkVersion.v3_5:
-            		return "ToolsVersion=\"4.0\"";
-                case FrameworkVersion.v3_0:
-                    return "ToolsVersion=\"3.0\"";
-                default:
-                    return "ToolsVersion=\"2.0\"";
-            }
-        }
-
-        public override string SolutionTag
-        {
-            get { return "# Visual Studio 2010"; }
-        }
-
-	    #endregion
-
-		#region Constructors
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="VS2005Target"/> class.
-		/// </summary>
-		public VS2010Target()
-			: base()
-		{
-		}
-
-		#endregion
-	}
-}
+using System;
+using System.IO;
+using System.Text;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+using System.CodeDom.Compiler;
+
+namespace Prebuild.Core.Targets
+{
+
+	/// <summary>
+	/// 
+	/// </summary>
+	[Target("vs2010")]
+	public class VS2010Target : VSGenericTarget
+	{
+		#region Fields
+		
+		string solutionVersion = "11.00";
+		string productVersion = "9.0.30729";
+		string schemaVersion = "2.0";
+		string versionName = "Visual Studio 2010";
+		string name = "vs2010";
+		VSVersion version = VSVersion.VS10;
+
+		#endregion
+		
+		#region Properties
+		
+		/// <summary>
+		/// Gets or sets the solution version.
+		/// </summary>
+		/// <value>The solution version.</value>
+		public override string SolutionVersion
+		{
+			get
+			{
+				return solutionVersion;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the product version.
+		/// </summary>
+		/// <value>The product version.</value>
+		public override string ProductVersion
+		{
+			get
+			{
+				return productVersion;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the schema version.
+		/// </summary>
+		/// <value>The schema version.</value>
+		public override string SchemaVersion
+		{
+			get
+			{
+				return schemaVersion;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the name of the version.
+		/// </summary>
+		/// <value>The name of the version.</value>
+		public override string VersionName
+		{
+			get
+			{
+				return versionName;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the version.
+		/// </summary>
+		/// <value>The version.</value>
+		public override VSVersion Version
+		{
+			get
+			{
+				return version;
+			}
+		}
+		
+		/// <summary>
+		/// Gets the name.
+		/// </summary>
+		/// <value>The name.</value>
+		public override string Name
+		{
+			get
+			{
+				return name;
+			}
+		}
+
+        protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
+        {
+            switch (frameworkVersion)
+            {
+            	case FrameworkVersion.v4_0:
+                case FrameworkVersion.v3_5:
+            		return "ToolsVersion=\"4.0\"";
+                case FrameworkVersion.v3_0:
+                    return "ToolsVersion=\"3.0\"";
+                default:
+                    return "ToolsVersion=\"2.0\"";
+            }
+        }
+
+        public override string SolutionTag
+        {
+            get { return "# Visual Studio 2010"; }
+        }
+
+	    #endregion
+
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="VS2005Target"/> class.
+		/// </summary>
+		public VS2010Target()
+			: base()
+		{
+		}
+
+		#endregion
+	}
+}

+ 922 - 922
Prebuild/src/Core/Targets/.svn/text-base/VSGenericTarget.cs.svn-base

@@ -1,922 +1,922 @@
-#region BSD License
-/*
-Copyright (c) 2008 Matthew Holmes ([email protected]), John Anderson ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions
-  and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
-  and the following disclaimer in the documentation and/or other materials provided with the
-  distribution.
- * The name of the author may not be used to endorse or promote products derived from this software
-  without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-using System.CodeDom.Compiler;
-
-namespace Prebuild.Core.Targets
-{
-
-	/// <summary>
-	/// 
-	/// </summary>
-	public abstract class VSGenericTarget : ITarget
-	{
-		#region Fields
-
-		readonly Dictionary<string, ToolInfo> tools = new Dictionary<string, ToolInfo>();
-		Kernel kernel;
-		#endregion
-
-		#region Properties
-		/// <summary>
-		/// Gets or sets the solution version.
-		/// </summary>
-		/// <value>The solution version.</value>
-		public abstract string SolutionVersion { get; }
-		/// <summary>
-		/// Gets or sets the product version.
-		/// </summary>
-		/// <value>The product version.</value>
-		public abstract string ProductVersion { get; }
-		/// <summary>
-		/// Gets or sets the schema version.
-		/// </summary>
-		/// <value>The schema version.</value>
-		public abstract string SchemaVersion { get; }
-		/// <summary>
-		/// Gets or sets the name of the version.
-		/// </summary>
-		/// <value>The name of the version.</value>
-		public abstract string VersionName { get; }
-		/// <summary>
-		/// Gets or sets the version.
-		/// </summary>
-		/// <value>The version.</value>
-		public abstract VSVersion Version { get; }
-		/// <summary>
-		/// Gets the name.
-		/// </summary>
-		/// <value>The name.</value>
-		public abstract string Name { get; }
-
-		protected abstract string GetToolsVersionXml(FrameworkVersion version);
-		public abstract string SolutionTag { get; }
-
-		#endregion
-
-		#region Constructors
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
-		/// </summary>
-		protected VSGenericTarget()
-		{
-			tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
-			tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
-			tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
-			tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
-			tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
-		}
-
-		#endregion
-
-		#region Private Methods
-
-		private string MakeRefPath(ProjectNode project)
-		{
-			string ret = "";
-			foreach (ReferencePathNode node in project.ReferencePaths)
-			{
-				try
-				{
-					string fullPath = Helper.ResolvePath(node.Path);
-					if (ret.Length < 1)
-					{
-						ret = fullPath;
-					}
-					else
-					{
-						ret += ";" + fullPath;
-					}
-				}
-				catch (ArgumentException)
-				{
-					kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
-				}
-			}
-
-			return ret;
-		}
-
-		private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
-		{
-			SolutionNode node = solution;
-
-			while (node.Parent is SolutionNode)
-				node = node.Parent as SolutionNode;
-
-			return FindProjectInSolutionRecursively(name, node);
-		}
-
-		private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
-		{
-			if (solution.ProjectsTable.ContainsKey(name))
-				return solution.ProjectsTable[name];
-
-			foreach (SolutionNode child in solution.Solutions)
-			{
-				ProjectNode node = FindProjectInSolutionRecursively(name, child);
-				if (node != null)
-					return node;
-			}
-
-			return null;
-		}
-
-		private void WriteProject(SolutionNode solution, ProjectNode project)
-		{
-			if (!tools.ContainsKey(project.Language))
-			{
-				throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
-			}
-
-			ToolInfo toolInfo = tools[project.Language];
-			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
-			StreamWriter ps = new StreamWriter(projectFile);
-
-			kernel.CurrentWorkingDirectory.Push();
-			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
-
-			#region Project File
-			using (ps)
-			{
-				ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
-				ps.WriteLine("	<PropertyGroup>");
-				ps.WriteLine("	  <ProjectType>Local</ProjectType>");
-				ps.WriteLine("	  <ProductVersion>{0}</ProductVersion>", ProductVersion);
-				ps.WriteLine("	  <SchemaVersion>{0}</SchemaVersion>", SchemaVersion);
-				ps.WriteLine("	  <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
-
-				// Visual Studio has a hard coded guid for the project type
-				if (project.Type == ProjectType.Web)
-					ps.WriteLine("	  <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
-				ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
-				ps.WriteLine("	  <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
-				ps.WriteLine("	  <AssemblyKeyContainerName>");
-				ps.WriteLine("	  </AssemblyKeyContainerName>");
-				ps.WriteLine("	  <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
-				foreach (ConfigurationNode conf in project.Configurations)
-				{
-					if (conf.Options.KeyFile != "")
-					{
-						ps.WriteLine("	  <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
-						ps.WriteLine("	  <SignAssembly>true</SignAssembly>");
-						break;
-					}
-				}
-				ps.WriteLine("	  <DefaultClientScript>JScript</DefaultClientScript>");
-				ps.WriteLine("	  <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
-				ps.WriteLine("	  <DefaultTargetSchema>IE50</DefaultTargetSchema>");
-				ps.WriteLine("	  <DelaySign>false</DelaySign>");
-				ps.WriteLine("	  <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
-
-				ps.WriteLine("	  <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
-				ps.WriteLine("	  <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
-				ps.WriteLine("	  <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
-				ps.WriteLine("	  <StartupObject>{0}</StartupObject>", project.StartupObject);
-				if (string.IsNullOrEmpty(project.DebugStartParameters))
-				{
-					ps.WriteLine("	  <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
-				}
-				ps.WriteLine("	  <FileUpgradeFlags>");
-				ps.WriteLine("	  </FileUpgradeFlags>");
-
-				ps.WriteLine("	</PropertyGroup>");
-
-				foreach (ConfigurationNode conf in project.Configurations)
-				{
-					ps.Write("	<PropertyGroup ");
-					ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
-					ps.WriteLine("	  <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
-					ps.WriteLine("	  <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
-					ps.WriteLine("	  <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
-					ps.WriteLine("	  <ConfigurationOverrideFile>");
-					ps.WriteLine("	  </ConfigurationOverrideFile>");
-					ps.WriteLine("	  <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
-					ps.WriteLine("	  <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
-					ps.WriteLine("	  <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
-					ps.WriteLine("	  <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
-					ps.WriteLine("	  <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
-					if (project.Type != ProjectType.Web)
-						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
-						             Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
-					else
-						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
-						             Helper.EndPath(Helper.NormalizePath("bin\\")));
-
-					ps.WriteLine("	  <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
-					ps.WriteLine("	  <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
-					ps.WriteLine("	  <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
-					ps.WriteLine("	  <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
-					ps.WriteLine("	  <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
-					ps.WriteLine("	  <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
-					ps.WriteLine("	  <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
-					ps.WriteLine("	</PropertyGroup>");
-				}
-
-				//ps.WriteLine("	  </Settings>");
-
-				Dictionary<ReferenceNode, ProjectNode> projectReferences = new Dictionary<ReferenceNode, ProjectNode>();
-				List<ReferenceNode> otherReferences = new List<ReferenceNode>();
-
-				foreach (ReferenceNode refr in project.References)
-				{
-					ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
-
-					if (projectNode == null)
-						otherReferences.Add(refr);
-					else
-						projectReferences.Add(refr, projectNode);
-				}
-				// Assembly References
-				ps.WriteLine("	<ItemGroup>");
-
-				foreach (ReferenceNode refr in otherReferences)
-				{
-					ps.Write("	  <Reference");
-					ps.Write(" Include=\"");
-					ps.Write(refr.Name);
-					ps.WriteLine("\" >");
-					ps.Write("		  <Name>");
-					ps.Write(refr.Name);
-					ps.WriteLine("</Name>");
-										
-					if(!String.IsNullOrEmpty(refr.Path))
-					{
-						// Use absolute path to assembly (for determining assembly type)
-						string absolutePath = Path.Combine(project.FullPath, refr.Path);
-						if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
-							// Assembly is an executable (exe)
-							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
-						} else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
-							// Assembly is an library (dll)							
-							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
-						} else {
-							string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
-							kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
-							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
-						}
-					}
-					
-					ps.WriteLine("		<Private>{0}</Private>", refr.LocalCopy);
-					ps.WriteLine("	  </Reference>");
-				}
-				ps.WriteLine("	</ItemGroup>");
-
-				//Project References
-				ps.WriteLine("	<ItemGroup>");
-				foreach (KeyValuePair<ReferenceNode, ProjectNode> pair in projectReferences)
-				{
-					ToolInfo tool = tools[pair.Value.Language];
-					if (tools == null)
-						throw new UnknownLanguageException();
-
-					string path =
-						Helper.MakePathRelativeTo(project.FullPath,
-						                          Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
-					ps.WriteLine("	  <ProjectReference Include=\"{0}\">", path);
-
-					// TODO: Allow reference to visual basic projects
-					ps.WriteLine("		<Name>{0}</Name>", pair.Value.Name);
-					ps.WriteLine("		<Project>{0}</Project>", pair.Value.Guid.ToString("B").ToUpper());
-					ps.WriteLine("		<Package>{0}</Package>", tool.Guid.ToUpper());
-
-					//This is the Copy Local flag in VS
-					ps.WriteLine("		<Private>{0}</Private>", pair.Key.LocalCopy);
-
-					ps.WriteLine("	  </ProjectReference>");
-				}
-				ps.WriteLine("	</ItemGroup>");
-
-				//				  ps.WriteLine("	</Build>");
-				ps.WriteLine("	<ItemGroup>");
-
-				//				  ps.WriteLine("	  <Include>");
-				List<string> list = new List<string>();
-
-				foreach (string path in project.Files)
-				{
-					string lower = path.ToLower();
-					if (lower.EndsWith(".resx"))
-					{
-						string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
-						if (!list.Contains(codebehind))
-							list.Add(codebehind);
-					}
-
-				}
-				
-				foreach (string filePath in project.Files)
-				{
-					//					if (file == "Properties\\Bind.Designer.cs")
-					//					{
-					//						Console.WriteLine("Wait a minute!");
-					//						Console.WriteLine(project.Files.GetSubType(file).ToString());
-					//					}
-					SubType subType = project.Files.GetSubType(filePath);
-					
-					// Visual Studio chokes on file names if forward slash is used as a path separator
-					// instead of backslash.  So we must make sure that all file paths written to the
-					// project file use \ as a path separator.
-					string file = filePath.Replace(@"/", @"\");
-
-					if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
-					    && subType != SubType.CodeBehind)
-					{
-						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
-						ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
-						ps.WriteLine("		<SubType>Designer</SubType>");
-						ps.WriteLine("	  </EmbeddedResource>");
-						//
-					}
-
-					if (subType == SubType.Designer)
-					{
-						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file);
-						
-						string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
-						string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
-
-						// Check for a parent .cs file with the same name as this designer file
-						if (File.Exists(Helper.NormalizePath(dependent_name)))
-						{
-							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
-						}
-						else
-						{
-							ps.WriteLine("		<Generator>ResXFileCodeGenerator</Generator>");
-							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
-							ps.WriteLine("		<SubType>" + subType + "</SubType>");
-						}
-						
-						ps.WriteLine("	  </EmbeddedResource>");
-						if (File.Exists(Helper.NormalizePath(autogen_name)))
-						{
-							ps.WriteLine("	  <Compile Include=\"{0}\">", autogen_name);
-							//ps.WriteLine("	  <DesignTime>True</DesignTime>");
-
-							// If a parent .cs file exists, link this autogen file to it. Otherwise link
-							// to the designer file
-							if (File.Exists(dependent_name))
-							{
-								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
-							}
-							else
-							{
-								ps.WriteLine("		<AutoGen>True</AutoGen>");
-								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
-							}
-							
-							ps.WriteLine("	  </Compile>");
-						}
-						list.Add(autogen_name);
-					}
-					if (subType == SubType.Settings)
-					{
-						ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
-						ps.WriteLine("Include=\"{0}\">", file);
-						string fileName = Path.GetFileName(filePath);
-						if (project.Files.GetBuildAction(filePath) == BuildAction.None)
-						{
-							ps.WriteLine("		<Generator>SettingsSingleFileGenerator</Generator>");
-							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
-						}
-						else
-						{
-							ps.WriteLine("		<SubType>Code</SubType>");
-							ps.WriteLine("		<AutoGen>True</AutoGen>");
-							ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
-							string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
-							string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
-							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
-						}
-						ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
-					}
-					else if (subType != SubType.Designer)
-					{
-						string path = Helper.NormalizePath(file);
-						string path_lower = path.ToLower();
-
-						if (!list.Contains(filePath))
-						{
-							ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
-
-							int startPos = 0;
-							if (project.Files.GetPreservePath(filePath))
-							{
-								while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
-									startPos++;
-
-							}
-							else
-							{
-								startPos = file.LastIndexOf(Path.GetFileName(path));
-							}
-							
-							// be sure to write out the path with backslashes so VS recognizes
-							// the file properly.
-							ps.WriteLine("Include=\"{0}\">", file);
-
-							int last_period_index = file.LastIndexOf('.');
-							string short_file_name = file.Substring(0, last_period_index);
-							string extension = Path.GetExtension(path);
-							// make this upper case, so that when File.Exists tests for the
-							// existence of a designer file on a case-sensitive platform,
-							// it is correctly identified.
-							string designer_format = string.Format(".Designer{0}", extension);
-
-							if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
-							{
-								int designer_index = path.IndexOf(designer_format);
-								string file_name = path.Substring(0, designer_index);
-
-								// There are two corrections to the next lines:
-								// 1. Fix the connection between a designer file and a form
-								//	  or usercontrol that don't have an associated resx file.
-								// 2. Connect settings files to associated designer files.
-								if (File.Exists(file_name + extension))
-									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension));
-								else if (File.Exists(file_name + ".resx"))
-									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
-								else if (File.Exists(file_name + ".settings"))
-								{
-									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings"));
-									ps.WriteLine("		<AutoGen>True</AutoGen>");
-									ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
-								}
-							}
-							else if (subType == SubType.CodeBehind)
-							{
-								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
-							}
-							if (project.Files.GetIsLink(filePath))
-							{
-								string alias = project.Files.GetLinkPath(filePath);
-								alias += file.Substring(startPos);
-								alias = Helper.NormalizePath(alias);
-								ps.WriteLine("		<Link>{0}</Link>", alias);
-							}
-							else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
-							{
-								if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
-								{
-									ps.WriteLine("		<SubType>{0}</SubType>", subType);
-								}
-							}
-
-							if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
-							{
-								ps.WriteLine("		<CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath));
-							}
-
-							ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
-						}
-					}
-				}
-
-				ps.WriteLine("	</ItemGroup>");
-				ps.WriteLine("	<Import Project=\"" + toolInfo.ImportProject + "\" />");
-				ps.WriteLine("	<PropertyGroup>");
-				ps.WriteLine("	  <PreBuildEvent>");
-				ps.WriteLine("	  </PreBuildEvent>");
-				ps.WriteLine("	  <PostBuildEvent>");
-				ps.WriteLine("	  </PostBuildEvent>");
-				ps.WriteLine("	</PropertyGroup>");
-				ps.WriteLine("</Project>");
-			}
-			#endregion
-
-			#region User File
-
-			ps = new StreamWriter(projectFile + ".user");
-			using (ps)
-			{
-				// Get the first configuration from the project.
-				ConfigurationNode firstConfiguration = null;
-
-				if (project.Configurations.Count > 0)
-				{
-					firstConfiguration = project.Configurations[0];
-				}
-
-				ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
-				//ps.WriteLine( "<VisualStudioProject>" );
-				//ps.WriteLine("  <{0}>", toolInfo.XMLTag);
-				//ps.WriteLine("	<Build>");
-				ps.WriteLine("	<PropertyGroup>");
-				//ps.WriteLine("	  <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
-
-				if (firstConfiguration != null)
-				{
-					ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", firstConfiguration.Name);
-					ps.WriteLine("	  <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", firstConfiguration.Platform);
-				}
-
-				ps.WriteLine("	  <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
-				ps.WriteLine("	  <LastOpenVersion>{0}</LastOpenVersion>", ProductVersion);
-				ps.WriteLine("	  <ProjectView>ProjectFiles</ProjectView>");
-				ps.WriteLine("	  <ProjectTrust>0</ProjectTrust>");
-				ps.WriteLine("	</PropertyGroup>");
-				foreach (ConfigurationNode conf in project.Configurations)
-				{
-					ps.Write("	<PropertyGroup");
-					ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|{1}' \"", conf.Name, conf.Platform);
-					ps.WriteLine(" />");
-				}
-				ps.WriteLine("</Project>");
-			}
-			#endregion
-
-			kernel.CurrentWorkingDirectory.Pop();
-		}
-
-		private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
-		{
-			kernel.Log.Write("Creating {0} solution and project files", VersionName);
-
-			foreach (SolutionNode child in solution.Solutions)
-			{
-				kernel.Log.Write("...Creating folder: {0}", child.Name);
-				WriteSolution(child, false);
-			}
-
-			foreach (ProjectNode project in solution.Projects)
-			{
-				kernel.Log.Write("...Creating project: {0}", project.Name);
-				WriteProject(solution, project);
-			}
-
-			foreach (DatabaseProjectNode project in solution.DatabaseProjects)
-			{
-				kernel.Log.Write("...Creating database project: {0}", project.Name);
-				WriteDatabaseProject(solution, project);
-			}
-
-			if (writeSolutionToDisk) // only write main solution
-			{
-				kernel.Log.Write("");
-				string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
-				
-				using (StreamWriter ss = new StreamWriter(solutionFile))
-				{
-					kernel.CurrentWorkingDirectory.Push();
-					Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
-
-					ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
-					ss.WriteLine(SolutionTag);
-
-					WriteProjectDeclarations(ss, solution, solution);
-
-					ss.WriteLine("Global");
-
-					ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
-					foreach (ConfigurationNode conf in solution.Configurations)
-					{
-						ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
-					}
-					ss.WriteLine("\tEndGlobalSection");
-
-					ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
-					WriteConfigurationLines(solution.Configurations, solution, ss);
-					ss.WriteLine("\tEndGlobalSection");
-
-					if (solution.Solutions.Count > 0)
-					{
-						ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
-						foreach (SolutionNode embeddedSolution in solution.Solutions)
-						{
-							WriteNestedProjectMap(ss, embeddedSolution);
-						}
-						ss.WriteLine("\tEndGlobalSection");
-					}
-
-					ss.WriteLine("EndGlobal");
-				}
-
-				kernel.CurrentWorkingDirectory.Pop();
-			}
-		}
-
-		private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
-		{
-			foreach (SolutionNode childSolution in embeddedSolution.Solutions)
-			{
-				WriteEmbeddedSolution(writer, childSolution);
-				WriteProjectDeclarations(writer, actualSolution, childSolution);
-			}
-
-			foreach (ProjectNode project in embeddedSolution.Projects)
-			{
-				WriteProject(actualSolution, writer, project);
-			}
-
-			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
-			{
-				WriteProject(actualSolution, writer, dbProject);
-			}
-
-			if (actualSolution.Guid == embeddedSolution.Guid)
-			{
-				WriteSolutionFiles(actualSolution, writer);
-			}
-		}
-
-		private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
-		{
-			foreach (ProjectNode project in embeddedSolution.Projects)
-			{
-				WriteNestedProject(writer, embeddedSolution, project.Guid);
-			}
-
-			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
-			{
-				WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
-			}
-
-			foreach (SolutionNode child in embeddedSolution.Solutions)
-			{
-				WriteNestedProject(writer, embeddedSolution, child.Guid);
-				WriteNestedProjectMap(writer, child);
-			}
-		}
-
-		private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
-		{
-			WriteNestedFolder(writer, solution.Guid, projectGuid);
-		}
-
-		private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
-		{
-			writer.WriteLine("\t\t{0} = {1}",
-			                 childGuid.ToString("B").ToUpper(),
-			                 parentGuid.ToString("B").ToUpper());
-		}
-
-		private static void WriteConfigurationLines(IEnumerable<ConfigurationNode> configurations, SolutionNode solution, TextWriter ss)
-		{
-			foreach (ProjectNode project in solution.Projects)
-			{
-				foreach (ConfigurationNode conf in configurations)
-				{
-					ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
-					             project.Guid.ToString("B").ToUpper(),
-					             conf.NameAndPlatform);
-
-					ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
-					             project.Guid.ToString("B").ToUpper(),
-					             conf.NameAndPlatform);
-				}
-			}
-
-			foreach (SolutionNode child in solution.Solutions)
-			{
-				WriteConfigurationLines(configurations, child, ss);
-			}
-		}
-
-		private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
-		{
-			if(solution.Files != null && solution.Files.Count > 0)
-				WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
-		}
-
-		private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
-		{
-			WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
-		}
-
-		private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
-		{
-			WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
-		}
-
-		private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
-		{
-			if (solution.Files != null && solution.Files.Count > 0)
-				WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
-		}
-
-		const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
-		const string ProjectDeclarationEndFormat = "EndProject";
-
-		private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
-		{
-			if (!tools.ContainsKey(language))
-				throw new UnknownLanguageException("Unknown .NET language: " + language);
-
-			ToolInfo toolInfo = tools[language];
-
-			string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
-
-			path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
-
-			WriteProject(ss, language, guid, name, path);
-		}
-
-		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
-		{
-			WriteProject(writer, language, projectGuid, name, location, null);
-		}
-
-		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
-		{
-			if (!tools.ContainsKey(language))
-				throw new UnknownLanguageException("Unknown .NET language: " + language);
-
-			ToolInfo toolInfo = tools[language];
-
-			writer.WriteLine(ProjectDeclarationBeginFormat,
-			                 toolInfo.Guid,
-			                 name,
-			                 location,
-			                 projectGuid.ToString("B").ToUpper());
-
-			if (files != null)
-			{
-				writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
-
-				foreach (string file in files)
-					writer.WriteLine("\t\t{0} = {0}", file);
-
-				writer.WriteLine("\tEndProjectSection");
-			}
-
-			writer.WriteLine(ProjectDeclarationEndFormat);
-		}
-
-		private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
-		{
-			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
-			IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), "	  ");
-
-			kernel.CurrentWorkingDirectory.Push();
-
-			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
-
-			using (ps)
-			{
-				ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
-				ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
-				ps.Indent++;
-				ps.WriteLine("MSDTVersion = \"80\"");
-				// TODO: Use the project.Files property
-				if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
-					WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
-
-				ps.WriteLine("Begin DBRefFolder = \"Database References\"");
-				ps.Indent++;
-				foreach (DatabaseReferenceNode reference in project.References)
-				{
-					ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
-					ps.Indent++;
-					ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
-					ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
-					//ps.WriteLine("Colorizer = 5");
-					ps.Indent--;
-					ps.WriteLine("End");
-				}
-				ps.Indent--;
-				ps.WriteLine("End");
-				ps.Indent--;
-				ps.WriteLine("End");
-
-				ps.Flush();
-			}
-
-			kernel.CurrentWorkingDirectory.Pop();
-		}
-
-		private static bool ContainsSqlFiles(string folder)
-		{
-			if(Directory.GetFiles(folder, "*.sql").Length > 0)
-				return true; // if the folder contains 1 .sql file, that's good enough
-
-			foreach (string child in Directory.GetDirectories(folder))
-			{
-				if (ContainsSqlFiles(child))
-					return true; // if 1 child folder contains a .sql file, still good enough
-			}
-
-			return false;
-		}
-
-		private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
-		{
-			foreach (string child in Directory.GetDirectories(folder))
-			{
-				if (ContainsSqlFiles(child))
-				{
-					writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
-					writer.Indent++;
-					WriteDatabaseFoldersAndFiles(writer, child);
-					writer.Indent--;
-					writer.WriteLine("End");
-				}
-			}
-			foreach (string file in Directory.GetFiles(folder, "*.sql"))
-			{
-				writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
-			}
-		}
-
-		private void CleanProject(ProjectNode project)
-		{
-			kernel.Log.Write("...Cleaning project: {0}", project.Name);
-
-			ToolInfo toolInfo = tools[project.Language];
-			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
-			string userFile = projectFile + ".user";
-
-			Helper.DeleteIfExists(projectFile);
-			Helper.DeleteIfExists(userFile);
-		}
-
-		private void CleanSolution(SolutionNode solution)
-		{
-			kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
-
-			string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
-			string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
-
-			Helper.DeleteIfExists(slnFile);
-			Helper.DeleteIfExists(suoFile);
-
-			foreach (ProjectNode project in solution.Projects)
-			{
-				CleanProject(project);
-			}
-
-			kernel.Log.Write("");
-		}
-
-		#endregion
-
-		#region ITarget Members
-
-		/// <summary>
-		/// Writes the specified kern.
-		/// </summary>
-		/// <param name="kern">The kern.</param>
-		public virtual void Write(Kernel kern)
-		{
-			if (kern == null)
-			{
-				throw new ArgumentNullException("kern");
-			}
-			kernel = kern;
-			foreach (SolutionNode sol in kernel.Solutions)
-			{
-				WriteSolution(sol, true);
-			}
-			kernel = null;
-		}
-
-		/// <summary>
-		/// Cleans the specified kern.
-		/// </summary>
-		/// <param name="kern">The kern.</param>
-		public virtual void Clean(Kernel kern)
-		{
-			if (kern == null)
-			{
-				throw new ArgumentNullException("kern");
-			}
-			kernel = kern;
-			foreach (SolutionNode sol in kernel.Solutions)
-			{
-				CleanSolution(sol);
-			}
-			kernel = null;
-		}
-
-		#endregion
-	}
-}
+#region BSD License
+/*
+Copyright (c) 2008 Matthew Holmes ([email protected]), John Anderson ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+  and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+  and the following disclaimer in the documentation and/or other materials provided with the
+  distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+  without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+using System.CodeDom.Compiler;
+
+namespace Prebuild.Core.Targets
+{
+
+	/// <summary>
+	/// 
+	/// </summary>
+	public abstract class VSGenericTarget : ITarget
+	{
+		#region Fields
+
+		readonly Dictionary<string, ToolInfo> tools = new Dictionary<string, ToolInfo>();
+		Kernel kernel;
+		#endregion
+
+		#region Properties
+		/// <summary>
+		/// Gets or sets the solution version.
+		/// </summary>
+		/// <value>The solution version.</value>
+		public abstract string SolutionVersion { get; }
+		/// <summary>
+		/// Gets or sets the product version.
+		/// </summary>
+		/// <value>The product version.</value>
+		public abstract string ProductVersion { get; }
+		/// <summary>
+		/// Gets or sets the schema version.
+		/// </summary>
+		/// <value>The schema version.</value>
+		public abstract string SchemaVersion { get; }
+		/// <summary>
+		/// Gets or sets the name of the version.
+		/// </summary>
+		/// <value>The name of the version.</value>
+		public abstract string VersionName { get; }
+		/// <summary>
+		/// Gets or sets the version.
+		/// </summary>
+		/// <value>The version.</value>
+		public abstract VSVersion Version { get; }
+		/// <summary>
+		/// Gets the name.
+		/// </summary>
+		/// <value>The name.</value>
+		public abstract string Name { get; }
+
+		protected abstract string GetToolsVersionXml(FrameworkVersion version);
+		public abstract string SolutionTag { get; }
+
+		#endregion
+
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
+		/// </summary>
+		protected VSGenericTarget()
+		{
+			tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
+			tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
+			tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
+			tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
+			tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
+		}
+
+		#endregion
+
+		#region Private Methods
+
+		private string MakeRefPath(ProjectNode project)
+		{
+			string ret = "";
+			foreach (ReferencePathNode node in project.ReferencePaths)
+			{
+				try
+				{
+					string fullPath = Helper.ResolvePath(node.Path);
+					if (ret.Length < 1)
+					{
+						ret = fullPath;
+					}
+					else
+					{
+						ret += ";" + fullPath;
+					}
+				}
+				catch (ArgumentException)
+				{
+					kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
+				}
+			}
+
+			return ret;
+		}
+
+		private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
+		{
+			SolutionNode node = solution;
+
+			while (node.Parent is SolutionNode)
+				node = node.Parent as SolutionNode;
+
+			return FindProjectInSolutionRecursively(name, node);
+		}
+
+		private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
+		{
+			if (solution.ProjectsTable.ContainsKey(name))
+				return solution.ProjectsTable[name];
+
+			foreach (SolutionNode child in solution.Solutions)
+			{
+				ProjectNode node = FindProjectInSolutionRecursively(name, child);
+				if (node != null)
+					return node;
+			}
+
+			return null;
+		}
+
+		private void WriteProject(SolutionNode solution, ProjectNode project)
+		{
+			if (!tools.ContainsKey(project.Language))
+			{
+				throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
+			}
+
+			ToolInfo toolInfo = tools[project.Language];
+			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+			StreamWriter ps = new StreamWriter(projectFile);
+
+			kernel.CurrentWorkingDirectory.Push();
+			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+			#region Project File
+			using (ps)
+			{
+				ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
+				ps.WriteLine("	<PropertyGroup>");
+				ps.WriteLine("	  <ProjectType>Local</ProjectType>");
+				ps.WriteLine("	  <ProductVersion>{0}</ProductVersion>", ProductVersion);
+				ps.WriteLine("	  <SchemaVersion>{0}</SchemaVersion>", SchemaVersion);
+				ps.WriteLine("	  <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
+
+				// Visual Studio has a hard coded guid for the project type
+				if (project.Type == ProjectType.Web)
+					ps.WriteLine("	  <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
+				ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
+				ps.WriteLine("	  <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
+				ps.WriteLine("	  <AssemblyKeyContainerName>");
+				ps.WriteLine("	  </AssemblyKeyContainerName>");
+				ps.WriteLine("	  <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
+				foreach (ConfigurationNode conf in project.Configurations)
+				{
+					if (conf.Options.KeyFile != "")
+					{
+						ps.WriteLine("	  <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
+						ps.WriteLine("	  <SignAssembly>true</SignAssembly>");
+						break;
+					}
+				}
+				ps.WriteLine("	  <DefaultClientScript>JScript</DefaultClientScript>");
+				ps.WriteLine("	  <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
+				ps.WriteLine("	  <DefaultTargetSchema>IE50</DefaultTargetSchema>");
+				ps.WriteLine("	  <DelaySign>false</DelaySign>");
+				ps.WriteLine("	  <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
+
+				ps.WriteLine("	  <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
+				ps.WriteLine("	  <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
+				ps.WriteLine("	  <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
+				ps.WriteLine("	  <StartupObject>{0}</StartupObject>", project.StartupObject);
+				if (string.IsNullOrEmpty(project.DebugStartParameters))
+				{
+					ps.WriteLine("	  <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
+				}
+				ps.WriteLine("	  <FileUpgradeFlags>");
+				ps.WriteLine("	  </FileUpgradeFlags>");
+
+				ps.WriteLine("	</PropertyGroup>");
+
+				foreach (ConfigurationNode conf in project.Configurations)
+				{
+					ps.Write("	<PropertyGroup ");
+					ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
+					ps.WriteLine("	  <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
+					ps.WriteLine("	  <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
+					ps.WriteLine("	  <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
+					ps.WriteLine("	  <ConfigurationOverrideFile>");
+					ps.WriteLine("	  </ConfigurationOverrideFile>");
+					ps.WriteLine("	  <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
+					ps.WriteLine("	  <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
+					ps.WriteLine("	  <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
+					ps.WriteLine("	  <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
+					ps.WriteLine("	  <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
+					if (project.Type != ProjectType.Web)
+						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
+						             Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
+					else
+						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
+						             Helper.EndPath(Helper.NormalizePath("bin\\")));
+
+					ps.WriteLine("	  <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
+					ps.WriteLine("	  <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
+					ps.WriteLine("	  <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
+					ps.WriteLine("	  <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
+					ps.WriteLine("	  <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
+					ps.WriteLine("	  <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
+					ps.WriteLine("	  <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
+					ps.WriteLine("	</PropertyGroup>");
+				}
+
+				//ps.WriteLine("	  </Settings>");
+
+				Dictionary<ReferenceNode, ProjectNode> projectReferences = new Dictionary<ReferenceNode, ProjectNode>();
+				List<ReferenceNode> otherReferences = new List<ReferenceNode>();
+
+				foreach (ReferenceNode refr in project.References)
+				{
+					ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
+
+					if (projectNode == null)
+						otherReferences.Add(refr);
+					else
+						projectReferences.Add(refr, projectNode);
+				}
+				// Assembly References
+				ps.WriteLine("	<ItemGroup>");
+
+				foreach (ReferenceNode refr in otherReferences)
+				{
+					ps.Write("	  <Reference");
+					ps.Write(" Include=\"");
+					ps.Write(refr.Name);
+					ps.WriteLine("\" >");
+					ps.Write("		  <Name>");
+					ps.Write(refr.Name);
+					ps.WriteLine("</Name>");
+										
+					if(!String.IsNullOrEmpty(refr.Path))
+					{
+						// Use absolute path to assembly (for determining assembly type)
+						string absolutePath = Path.Combine(project.FullPath, refr.Path);
+						if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
+							// Assembly is an executable (exe)
+							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
+						} else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
+							// Assembly is an library (dll)							
+							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+						} else {
+							string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
+							kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
+							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+						}
+					}
+					
+					ps.WriteLine("		<Private>{0}</Private>", refr.LocalCopy);
+					ps.WriteLine("	  </Reference>");
+				}
+				ps.WriteLine("	</ItemGroup>");
+
+				//Project References
+				ps.WriteLine("	<ItemGroup>");
+				foreach (KeyValuePair<ReferenceNode, ProjectNode> pair in projectReferences)
+				{
+					ToolInfo tool = tools[pair.Value.Language];
+					if (tools == null)
+						throw new UnknownLanguageException();
+
+					string path =
+						Helper.MakePathRelativeTo(project.FullPath,
+						                          Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
+					ps.WriteLine("	  <ProjectReference Include=\"{0}\">", path);
+
+					// TODO: Allow reference to visual basic projects
+					ps.WriteLine("		<Name>{0}</Name>", pair.Value.Name);
+					ps.WriteLine("		<Project>{0}</Project>", pair.Value.Guid.ToString("B").ToUpper());
+					ps.WriteLine("		<Package>{0}</Package>", tool.Guid.ToUpper());
+
+					//This is the Copy Local flag in VS
+					ps.WriteLine("		<Private>{0}</Private>", pair.Key.LocalCopy);
+
+					ps.WriteLine("	  </ProjectReference>");
+				}
+				ps.WriteLine("	</ItemGroup>");
+
+				//				  ps.WriteLine("	</Build>");
+				ps.WriteLine("	<ItemGroup>");
+
+				//				  ps.WriteLine("	  <Include>");
+				List<string> list = new List<string>();
+
+				foreach (string path in project.Files)
+				{
+					string lower = path.ToLower();
+					if (lower.EndsWith(".resx"))
+					{
+						string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
+						if (!list.Contains(codebehind))
+							list.Add(codebehind);
+					}
+
+				}
+				
+				foreach (string filePath in project.Files)
+				{
+					//					if (file == "Properties\\Bind.Designer.cs")
+					//					{
+					//						Console.WriteLine("Wait a minute!");
+					//						Console.WriteLine(project.Files.GetSubType(file).ToString());
+					//					}
+					SubType subType = project.Files.GetSubType(filePath);
+					
+					// Visual Studio chokes on file names if forward slash is used as a path separator
+					// instead of backslash.  So we must make sure that all file paths written to the
+					// project file use \ as a path separator.
+					string file = filePath.Replace(@"/", @"\");
+
+					if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
+					    && subType != SubType.CodeBehind)
+					{
+						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
+						ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
+						ps.WriteLine("		<SubType>Designer</SubType>");
+						ps.WriteLine("	  </EmbeddedResource>");
+						//
+					}
+
+					if (subType == SubType.Designer)
+					{
+						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file);
+						
+						string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
+						string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
+
+						// Check for a parent .cs file with the same name as this designer file
+						if (File.Exists(Helper.NormalizePath(dependent_name)))
+						{
+							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
+						}
+						else
+						{
+							ps.WriteLine("		<Generator>ResXFileCodeGenerator</Generator>");
+							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
+							ps.WriteLine("		<SubType>" + subType + "</SubType>");
+						}
+						
+						ps.WriteLine("	  </EmbeddedResource>");
+						if (File.Exists(Helper.NormalizePath(autogen_name)))
+						{
+							ps.WriteLine("	  <Compile Include=\"{0}\">", autogen_name);
+							//ps.WriteLine("	  <DesignTime>True</DesignTime>");
+
+							// If a parent .cs file exists, link this autogen file to it. Otherwise link
+							// to the designer file
+							if (File.Exists(dependent_name))
+							{
+								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
+							}
+							else
+							{
+								ps.WriteLine("		<AutoGen>True</AutoGen>");
+								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
+							}
+							
+							ps.WriteLine("	  </Compile>");
+						}
+						list.Add(autogen_name);
+					}
+					if (subType == SubType.Settings)
+					{
+						ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
+						ps.WriteLine("Include=\"{0}\">", file);
+						string fileName = Path.GetFileName(filePath);
+						if (project.Files.GetBuildAction(filePath) == BuildAction.None)
+						{
+							ps.WriteLine("		<Generator>SettingsSingleFileGenerator</Generator>");
+							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
+						}
+						else
+						{
+							ps.WriteLine("		<SubType>Code</SubType>");
+							ps.WriteLine("		<AutoGen>True</AutoGen>");
+							ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
+							string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
+							string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
+							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
+						}
+						ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
+					}
+					else if (subType != SubType.Designer)
+					{
+						string path = Helper.NormalizePath(file);
+						string path_lower = path.ToLower();
+
+						if (!list.Contains(filePath))
+						{
+							ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
+
+							int startPos = 0;
+							if (project.Files.GetPreservePath(filePath))
+							{
+								while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
+									startPos++;
+
+							}
+							else
+							{
+								startPos = file.LastIndexOf(Path.GetFileName(path));
+							}
+							
+							// be sure to write out the path with backslashes so VS recognizes
+							// the file properly.
+							ps.WriteLine("Include=\"{0}\">", file);
+
+							int last_period_index = file.LastIndexOf('.');
+							string short_file_name = file.Substring(0, last_period_index);
+							string extension = Path.GetExtension(path);
+							// make this upper case, so that when File.Exists tests for the
+							// existence of a designer file on a case-sensitive platform,
+							// it is correctly identified.
+							string designer_format = string.Format(".Designer{0}", extension);
+
+							if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
+							{
+								int designer_index = path.IndexOf(designer_format);
+								string file_name = path.Substring(0, designer_index);
+
+								// There are two corrections to the next lines:
+								// 1. Fix the connection between a designer file and a form
+								//	  or usercontrol that don't have an associated resx file.
+								// 2. Connect settings files to associated designer files.
+								if (File.Exists(file_name + extension))
+									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension));
+								else if (File.Exists(file_name + ".resx"))
+									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
+								else if (File.Exists(file_name + ".settings"))
+								{
+									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings"));
+									ps.WriteLine("		<AutoGen>True</AutoGen>");
+									ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
+								}
+							}
+							else if (subType == SubType.CodeBehind)
+							{
+								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
+							}
+							if (project.Files.GetIsLink(filePath))
+							{
+								string alias = project.Files.GetLinkPath(filePath);
+								alias += file.Substring(startPos);
+								alias = Helper.NormalizePath(alias);
+								ps.WriteLine("		<Link>{0}</Link>", alias);
+							}
+							else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
+							{
+								if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
+								{
+									ps.WriteLine("		<SubType>{0}</SubType>", subType);
+								}
+							}
+
+							if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
+							{
+								ps.WriteLine("		<CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath));
+							}
+
+							ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
+						}
+					}
+				}
+
+				ps.WriteLine("	</ItemGroup>");
+				ps.WriteLine("	<Import Project=\"" + toolInfo.ImportProject + "\" />");
+				ps.WriteLine("	<PropertyGroup>");
+				ps.WriteLine("	  <PreBuildEvent>");
+				ps.WriteLine("	  </PreBuildEvent>");
+				ps.WriteLine("	  <PostBuildEvent>");
+				ps.WriteLine("	  </PostBuildEvent>");
+				ps.WriteLine("	</PropertyGroup>");
+				ps.WriteLine("</Project>");
+			}
+			#endregion
+
+			#region User File
+
+			ps = new StreamWriter(projectFile + ".user");
+			using (ps)
+			{
+				// Get the first configuration from the project.
+				ConfigurationNode firstConfiguration = null;
+
+				if (project.Configurations.Count > 0)
+				{
+					firstConfiguration = project.Configurations[0];
+				}
+
+				ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
+				//ps.WriteLine( "<VisualStudioProject>" );
+				//ps.WriteLine("  <{0}>", toolInfo.XMLTag);
+				//ps.WriteLine("	<Build>");
+				ps.WriteLine("	<PropertyGroup>");
+				//ps.WriteLine("	  <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
+
+				if (firstConfiguration != null)
+				{
+					ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", firstConfiguration.Name);
+					ps.WriteLine("	  <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", firstConfiguration.Platform);
+				}
+
+				ps.WriteLine("	  <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
+				ps.WriteLine("	  <LastOpenVersion>{0}</LastOpenVersion>", ProductVersion);
+				ps.WriteLine("	  <ProjectView>ProjectFiles</ProjectView>");
+				ps.WriteLine("	  <ProjectTrust>0</ProjectTrust>");
+				ps.WriteLine("	</PropertyGroup>");
+				foreach (ConfigurationNode conf in project.Configurations)
+				{
+					ps.Write("	<PropertyGroup");
+					ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|{1}' \"", conf.Name, conf.Platform);
+					ps.WriteLine(" />");
+				}
+				ps.WriteLine("</Project>");
+			}
+			#endregion
+
+			kernel.CurrentWorkingDirectory.Pop();
+		}
+
+		private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
+		{
+			kernel.Log.Write("Creating {0} solution and project files", VersionName);
+
+			foreach (SolutionNode child in solution.Solutions)
+			{
+				kernel.Log.Write("...Creating folder: {0}", child.Name);
+				WriteSolution(child, false);
+			}
+
+			foreach (ProjectNode project in solution.Projects)
+			{
+				kernel.Log.Write("...Creating project: {0}", project.Name);
+				WriteProject(solution, project);
+			}
+
+			foreach (DatabaseProjectNode project in solution.DatabaseProjects)
+			{
+				kernel.Log.Write("...Creating database project: {0}", project.Name);
+				WriteDatabaseProject(solution, project);
+			}
+
+			if (writeSolutionToDisk) // only write main solution
+			{
+				kernel.Log.Write("");
+				string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+				
+				using (StreamWriter ss = new StreamWriter(solutionFile))
+				{
+					kernel.CurrentWorkingDirectory.Push();
+					Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
+
+					ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
+					ss.WriteLine(SolutionTag);
+
+					WriteProjectDeclarations(ss, solution, solution);
+
+					ss.WriteLine("Global");
+
+					ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
+					foreach (ConfigurationNode conf in solution.Configurations)
+					{
+						ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
+					}
+					ss.WriteLine("\tEndGlobalSection");
+
+					ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
+					WriteConfigurationLines(solution.Configurations, solution, ss);
+					ss.WriteLine("\tEndGlobalSection");
+
+					if (solution.Solutions.Count > 0)
+					{
+						ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
+						foreach (SolutionNode embeddedSolution in solution.Solutions)
+						{
+							WriteNestedProjectMap(ss, embeddedSolution);
+						}
+						ss.WriteLine("\tEndGlobalSection");
+					}
+
+					ss.WriteLine("EndGlobal");
+				}
+
+				kernel.CurrentWorkingDirectory.Pop();
+			}
+		}
+
+		private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
+		{
+			foreach (SolutionNode childSolution in embeddedSolution.Solutions)
+			{
+				WriteEmbeddedSolution(writer, childSolution);
+				WriteProjectDeclarations(writer, actualSolution, childSolution);
+			}
+
+			foreach (ProjectNode project in embeddedSolution.Projects)
+			{
+				WriteProject(actualSolution, writer, project);
+			}
+
+			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
+			{
+				WriteProject(actualSolution, writer, dbProject);
+			}
+
+			if (actualSolution.Guid == embeddedSolution.Guid)
+			{
+				WriteSolutionFiles(actualSolution, writer);
+			}
+		}
+
+		private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
+		{
+			foreach (ProjectNode project in embeddedSolution.Projects)
+			{
+				WriteNestedProject(writer, embeddedSolution, project.Guid);
+			}
+
+			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
+			{
+				WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
+			}
+
+			foreach (SolutionNode child in embeddedSolution.Solutions)
+			{
+				WriteNestedProject(writer, embeddedSolution, child.Guid);
+				WriteNestedProjectMap(writer, child);
+			}
+		}
+
+		private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
+		{
+			WriteNestedFolder(writer, solution.Guid, projectGuid);
+		}
+
+		private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
+		{
+			writer.WriteLine("\t\t{0} = {1}",
+			                 childGuid.ToString("B").ToUpper(),
+			                 parentGuid.ToString("B").ToUpper());
+		}
+
+		private static void WriteConfigurationLines(IEnumerable<ConfigurationNode> configurations, SolutionNode solution, TextWriter ss)
+		{
+			foreach (ProjectNode project in solution.Projects)
+			{
+				foreach (ConfigurationNode conf in configurations)
+				{
+					ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
+					             project.Guid.ToString("B").ToUpper(),
+					             conf.NameAndPlatform);
+
+					ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
+					             project.Guid.ToString("B").ToUpper(),
+					             conf.NameAndPlatform);
+				}
+			}
+
+			foreach (SolutionNode child in solution.Solutions)
+			{
+				WriteConfigurationLines(configurations, child, ss);
+			}
+		}
+
+		private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
+		{
+			if(solution.Files != null && solution.Files.Count > 0)
+				WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
+		}
+
+		private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
+		{
+			WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
+		}
+
+		private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
+		{
+			WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
+		}
+
+		private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
+		{
+			if (solution.Files != null && solution.Files.Count > 0)
+				WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
+		}
+
+		const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
+		const string ProjectDeclarationEndFormat = "EndProject";
+
+		private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
+		{
+			if (!tools.ContainsKey(language))
+				throw new UnknownLanguageException("Unknown .NET language: " + language);
+
+			ToolInfo toolInfo = tools[language];
+
+			string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
+
+			path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
+
+			WriteProject(ss, language, guid, name, path);
+		}
+
+		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
+		{
+			WriteProject(writer, language, projectGuid, name, location, null);
+		}
+
+		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
+		{
+			if (!tools.ContainsKey(language))
+				throw new UnknownLanguageException("Unknown .NET language: " + language);
+
+			ToolInfo toolInfo = tools[language];
+
+			writer.WriteLine(ProjectDeclarationBeginFormat,
+			                 toolInfo.Guid,
+			                 name,
+			                 location,
+			                 projectGuid.ToString("B").ToUpper());
+
+			if (files != null)
+			{
+				writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
+
+				foreach (string file in files)
+					writer.WriteLine("\t\t{0} = {0}", file);
+
+				writer.WriteLine("\tEndProjectSection");
+			}
+
+			writer.WriteLine(ProjectDeclarationEndFormat);
+		}
+
+		private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
+		{
+			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
+			IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), "	  ");
+
+			kernel.CurrentWorkingDirectory.Push();
+
+			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+			using (ps)
+			{
+				ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
+				ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
+				ps.Indent++;
+				ps.WriteLine("MSDTVersion = \"80\"");
+				// TODO: Use the project.Files property
+				if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
+					WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
+
+				ps.WriteLine("Begin DBRefFolder = \"Database References\"");
+				ps.Indent++;
+				foreach (DatabaseReferenceNode reference in project.References)
+				{
+					ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
+					ps.Indent++;
+					ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
+					ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
+					//ps.WriteLine("Colorizer = 5");
+					ps.Indent--;
+					ps.WriteLine("End");
+				}
+				ps.Indent--;
+				ps.WriteLine("End");
+				ps.Indent--;
+				ps.WriteLine("End");
+
+				ps.Flush();
+			}
+
+			kernel.CurrentWorkingDirectory.Pop();
+		}
+
+		private static bool ContainsSqlFiles(string folder)
+		{
+			if(Directory.GetFiles(folder, "*.sql").Length > 0)
+				return true; // if the folder contains 1 .sql file, that's good enough
+
+			foreach (string child in Directory.GetDirectories(folder))
+			{
+				if (ContainsSqlFiles(child))
+					return true; // if 1 child folder contains a .sql file, still good enough
+			}
+
+			return false;
+		}
+
+		private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
+		{
+			foreach (string child in Directory.GetDirectories(folder))
+			{
+				if (ContainsSqlFiles(child))
+				{
+					writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
+					writer.Indent++;
+					WriteDatabaseFoldersAndFiles(writer, child);
+					writer.Indent--;
+					writer.WriteLine("End");
+				}
+			}
+			foreach (string file in Directory.GetFiles(folder, "*.sql"))
+			{
+				writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
+			}
+		}
+
+		private void CleanProject(ProjectNode project)
+		{
+			kernel.Log.Write("...Cleaning project: {0}", project.Name);
+
+			ToolInfo toolInfo = tools[project.Language];
+			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+			string userFile = projectFile + ".user";
+
+			Helper.DeleteIfExists(projectFile);
+			Helper.DeleteIfExists(userFile);
+		}
+
+		private void CleanSolution(SolutionNode solution)
+		{
+			kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
+
+			string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+			string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
+
+			Helper.DeleteIfExists(slnFile);
+			Helper.DeleteIfExists(suoFile);
+
+			foreach (ProjectNode project in solution.Projects)
+			{
+				CleanProject(project);
+			}
+
+			kernel.Log.Write("");
+		}
+
+		#endregion
+
+		#region ITarget Members
+
+		/// <summary>
+		/// Writes the specified kern.
+		/// </summary>
+		/// <param name="kern">The kern.</param>
+		public virtual void Write(Kernel kern)
+		{
+			if (kern == null)
+			{
+				throw new ArgumentNullException("kern");
+			}
+			kernel = kern;
+			foreach (SolutionNode sol in kernel.Solutions)
+			{
+				WriteSolution(sol, true);
+			}
+			kernel = null;
+		}
+
+		/// <summary>
+		/// Cleans the specified kern.
+		/// </summary>
+		/// <param name="kern">The kern.</param>
+		public virtual void Clean(Kernel kern)
+		{
+			if (kern == null)
+			{
+				throw new ArgumentNullException("kern");
+			}
+			kernel = kern;
+			foreach (SolutionNode sol in kernel.Solutions)
+			{
+				CleanSolution(sol);
+			}
+			kernel = null;
+		}
+
+		#endregion
+	}
+}

+ 1070 - 1070
Prebuild/src/Core/Targets/AutotoolsTarget.cs

@@ -1,1070 +1,1070 @@
-#region BSD License
-/*
-
-Copyright (c) 2004 - 2008
-Matthew Holmes        ([email protected]),
-Dan     Moorehead     ([email protected]),
-Dave    Hudson        ([email protected]),
-C.J.    Adams-Collier ([email protected]),
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-* Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-* The name of the author may not be used to endorse or promote
-products derived from this software without specific prior written
-permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-*/
-#endregion
-
-#region MIT X11 license
-
-/*
- Portions of this file authored by Lluis Sanchez Gual
-
- Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- 
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- 
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#endregion
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Reflection;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Xml;
-using System.Xml.Xsl;
-using System.Net;
-using System.Diagnostics;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-
-namespace Prebuild.Core.Targets
-{
-    public enum ClrVersion
-    {
-        Default,
-        Net_1_1,
-        Net_2_0
-    }
-
-    public class SystemPackage
-    {
-        string name;
-        string version;
-        string description;
-        string[] assemblies;
-        bool isInternal;
-        ClrVersion targetVersion;
-
-        public void Initialize(string name,
-                               string version,
-                               string description,
-                               string[] assemblies,
-                               ClrVersion targetVersion,
-                               bool isInternal)
-        {
-            this.isInternal = isInternal;
-            this.name = name;
-            this.version = version;
-            this.assemblies = assemblies;
-            this.description = description;
-            this.targetVersion = targetVersion;
-        }
-
-        public string Name
-        {
-            get { return name; }
-        }
-
-        public string Version
-        {
-            get { return version; }
-        }
-
-        public string Description
-        {
-            get { return description; }
-        }
-
-        public ClrVersion TargetVersion
-        {
-            get { return targetVersion; }
-        }
-
-        // The package is part of the mono SDK
-        public bool IsCorePackage
-        {
-            get { return name == "mono"; }
-        }
-
-        // The package has been registered by an add-in, and is not installed
-        // in the system.
-        public bool IsInternalPackage
-        {
-            get { return isInternal; }
-        }
-
-        public string[] Assemblies
-        {
-            get { return assemblies; }
-        }
-
-    }
-
-
-    /// <summary>
-    /// 
-    /// </summary>
-    [Target("autotools")]
-    public class AutotoolsTarget : ITarget
-    {
-        #region Fields
-
-        Kernel m_Kernel;
-        XmlDocument autotoolsDoc;
-        XmlUrlResolver xr;
-        System.Security.Policy.Evidence e;
-        readonly Dictionary<string, SystemPackage> assemblyPathToPackage = new Dictionary<string, SystemPackage>();
-        readonly Dictionary<string, string> assemblyFullNameToPath = new Dictionary<string, string>();
-        readonly Dictionary<string, SystemPackage> packagesHash = new Dictionary<string, SystemPackage>();
-        readonly List<SystemPackage> packages = new List<SystemPackage>();
-
-        #endregion
-
-        #region Private Methods
-
-        private static void mkdirDashP(string dirName)
-        {
-            DirectoryInfo di = new DirectoryInfo(dirName);
-            if (di.Exists)
-                return;
-
-            string parentDirName = System.IO.Path.GetDirectoryName(dirName);
-            DirectoryInfo parentDi = new DirectoryInfo(parentDirName);
-            if (!parentDi.Exists)
-                mkdirDashP(parentDirName);
-
-            di.Create();
-        }
-
-        private static void chkMkDir(string dirName)
-        {
-            System.IO.DirectoryInfo di =
-                new System.IO.DirectoryInfo(dirName);
-
-            if (!di.Exists)
-                di.Create();
-        }
-
-        private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
-        {
-            // Create an XslTransform for this file
-            XslTransform templateTransformer =
-                new XslTransform();
-
-            // Load up the template
-            XmlNode templateNode =
-                autotoolsDoc.SelectSingleNode(nodeName + "/*");
-            templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
-
-            // Create a writer for the transformed template
-            XmlTextWriter templateWriter =
-                new XmlTextWriter(filename, null);
-
-            // Perform transformation, writing the file
-            templateTransformer.Transform
-                (m_Kernel.CurrentDoc, argList, templateWriter, xr);
-        }
-
-        static string NormalizeAsmName(string name)
-        {
-            int i = name.IndexOf(", PublicKeyToken=null");
-            if (i != -1)
-                return name.Substring(0, i).Trim();
-            return name;
-        }
-
-        private void AddAssembly(string assemblyfile, SystemPackage package)
-        {
-            if (!File.Exists(assemblyfile))
-                return;
-
-            try
-            {
-                System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile);
-                assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
-                assemblyPathToPackage[assemblyfile] = package;
-            }
-            catch
-            {
-            }
-        }
-
-        private static List<string> GetAssembliesWithLibInfo(string line, string file)
-        {
-            List<string> references = new List<string>();
-            List<string> libdirs = new List<string>();
-            List<string> retval = new List<string>();
-            foreach (string piece in line.Split(' '))
-            {
-                if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
-                {
-                    references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
-                }
-                else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
-                {
-                    libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
-                }
-            }
-
-            foreach (string refrnc in references)
-            {
-                foreach (string libdir in libdirs)
-                {
-                    if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
-                    {
-                        retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
-                    }
-                }
-            }
-
-            return retval;
-        }
-
-        private static List<string> GetAssembliesWithoutLibInfo(string line, string file)
-        {
-            List<string> references = new List<string>();
-            foreach (string reference in line.Split(' '))
-            {
-                if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
-                {
-                    string final_ref = reference.Substring(3).Trim();
-                    references.Add(ProcessPiece(final_ref, file));
-                }
-            }
-            return references;
-        }
-
-        private static string ProcessPiece(string piece, string pcfile)
-        {
-            int start = piece.IndexOf("${");
-            if (start == -1)
-                return piece;
-
-            int end = piece.IndexOf("}");
-            if (end == -1)
-                return piece;
-
-            string variable = piece.Substring(start + 2, end - start - 2);
-            string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
-            return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
-        }
-
-        private static string GetVariableFromPkgConfig(string var, string pcfile)
-        {
-            ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
-            psi.RedirectStandardOutput = true;
-            psi.UseShellExecute = false;
-            psi.Arguments = String.Format("--variable={0} {1}", var, pcfile);
-            Process p = new Process();
-            p.StartInfo = psi;
-            p.Start();
-            string ret = p.StandardOutput.ReadToEnd().Trim();
-            p.WaitForExit();
-            if (String.IsNullOrEmpty(ret))
-                return String.Empty;
-            return ret;
-        }
-
-        private void ParsePCFile(string pcfile)
-        {
-            // Don't register the package twice
-            string pname = Path.GetFileNameWithoutExtension(pcfile);
-            if (packagesHash.ContainsKey(pname))
-                return;
-
-            List<string> fullassemblies = null;
-            string version = "";
-            string desc = "";
-
-            SystemPackage package = new SystemPackage();
-
-            using (StreamReader reader = new StreamReader(pcfile))
-            {
-                string line;
-                while ((line = reader.ReadLine()) != null)
-                {
-                    string lowerLine = line.ToLower();
-                    if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
-                    {
-                        string choppedLine = line.Substring(5).Trim();
-                        if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
-                        {
-                            fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
-                        }
-                        else
-                        {
-                            fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
-                        }
-                    }
-                    else if (lowerLine.StartsWith("version:"))
-                    {
-                        // "version:".Length == 8
-                        version = line.Substring(8).Trim();
-                    }
-                    else if (lowerLine.StartsWith("description:"))
-                    {
-                        // "description:".Length == 12
-                        desc = line.Substring(12).Trim();
-                    }
-                }
-            }
-
-            if (fullassemblies == null)
-                return;
-
-            foreach (string assembly in fullassemblies)
-            {
-                AddAssembly(assembly, package);
-            }
-
-            package.Initialize(pname,
-                               version,
-                               desc,
-                               fullassemblies.ToArray(),
-                               ClrVersion.Default,
-                               false);
-            packages.Add(package);
-            packagesHash[pname] = package;
-        }
-
-        void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
-        {
-            SystemPackage package = new SystemPackage();
-            List<string> list = new List<string>();
-
-            string dir = Path.Combine(prefix, version);
-            if (!Directory.Exists(dir))
-            {
-                return;
-            }
-
-            foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
-            {
-                AddAssembly(assembly, package);
-                list.Add(assembly);
-            }
-
-            package.Initialize("mono",
-                               version,
-                               "The Mono runtime",
-                               list.ToArray(),
-                               ver,
-                               false);
-            packages.Add(package);
-        }
-
-        void RunInitialization()
-        {
-            string versionDir;
-
-            if (Environment.Version.Major == 1)
-            {
-                versionDir = "1.0";
-            }
-            else
-            {
-                versionDir = "2.0";
-            }
-
-            //Pull up assemblies from the installed mono system.
-            string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
-
-            if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
-                prefix = Path.Combine(prefix, "mono");
-            else
-                prefix = Path.GetDirectoryName(prefix);
-
-            RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
-            RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
-
-            string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
-            string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
-
-            if (String.IsNullOrEmpty(libpath))
-            {
-                string path_dirs = Environment.GetEnvironmentVariable("PATH");
-                foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
-                {
-                    if (pathdir == null)
-                        continue;
-                    if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
-                    {
-                        libpath = Path.Combine(pathdir, "..");
-                        libpath = Path.Combine(libpath, "lib");
-                        libpath = Path.Combine(libpath, "pkgconfig");
-                        break;
-                    }
-                }
-            }
-            search_dirs += Path.PathSeparator + libpath;
-            if (!string.IsNullOrEmpty(search_dirs))
-            {
-                List<string> scanDirs = new List<string>();
-                foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
-                {
-                    if (!scanDirs.Contains(potentialDir))
-                        scanDirs.Add(potentialDir);
-                }
-                foreach (string pcdir in scanDirs)
-                {
-                    if (pcdir == null)
-                        continue;
-
-                    if (Directory.Exists(pcdir))
-                    {
-                        foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
-                        {
-                            ParsePCFile(pcfile);
-                        }
-                    }
-                }
-            }
-        }
-
-        private void WriteCombine(SolutionNode solution)
-        {
-            #region "Create Solution directory if it doesn't exist"
-            string solutionDir = Path.Combine(solution.FullPath,
-                                              Path.Combine("autotools",
-                                                           solution.Name));
-            chkMkDir(solutionDir);
-            #endregion
-
-            #region "Write Solution-level files"
-            XsltArgumentList argList = new XsltArgumentList();
-            argList.AddParam("solutionName", "", solution.Name);
-            // $solutionDir is $rootDir/$solutionName/
-            transformToFile(Path.Combine(solutionDir, "configure.ac"),
-                            argList, "/Autotools/SolutionConfigureAc");
-            transformToFile(Path.Combine(solutionDir, "Makefile.am"),
-                            argList, "/Autotools/SolutionMakefileAm");
-            transformToFile(Path.Combine(solutionDir, "autogen.sh"),
-                            argList, "/Autotools/SolutionAutogenSh");
-            #endregion
-
-            foreach (ProjectNode project in solution.ProjectsTableOrder)
-            {
-              m_Kernel.Log.Write(String.Format("Writing project: {0}",
-                                               project.Name));
-              WriteProject(solution, project);
-            }
-        }
-
-        private static string FindFileReference(string refName,
-                                                ProjectNode project)
-        {
-            foreach (ReferencePathNode refPath in project.ReferencePaths)
-            {
-              string fullPath =
-                Helper.MakeFilePath(refPath.Path, refName, "dll");
-
-              if (File.Exists(fullPath)) {
-                return fullPath;
-              }
-            }
-
-            return null;
-        }
-
-        /// <summary>
-        /// Gets the XML doc file.
-        /// </summary>
-        /// <param name="project">The project.</param>
-        /// <param name="conf">The conf.</param>
-        /// <returns></returns>
-        public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
-        {
-            if (conf == null)
-            {
-                throw new ArgumentNullException("conf");
-            }
-            if (project == null)
-            {
-                throw new ArgumentNullException("project");
-            }
-            string docFile = (string)conf.Options["XmlDocFile"];
-            //			if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
-            //			{
-            //				return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
-            //			}
-            return docFile;
-        }
-
-        /// <summary>
-        /// Normalizes the path.
-        /// </summary>
-        /// <param name="path">The path.</param>
-        /// <returns></returns>
-        public static string NormalizePath(string path)
-        {
-            if (path == null)
-            {
-                return "";
-            }
-
-            StringBuilder tmpPath;
-
-            if (Core.Parse.Preprocessor.GetOS() == "Win32")
-            {
-                tmpPath = new StringBuilder(path.Replace('\\', '/'));
-                tmpPath.Replace("/", @"\\");
-            }
-            else
-            {
-                tmpPath = new StringBuilder(path.Replace('\\', '/'));
-                tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
-            }
-            return tmpPath.ToString();
-        }
-
-        private void WriteProject(SolutionNode solution, ProjectNode project)
-        {
-            string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
-            string projectDir = Path.Combine(solutionDir, project.Name);
-            string projectVersion = project.Version;
-            bool hasAssemblyConfig = false;
-            chkMkDir(projectDir);
-
-            List<string>
-                compiledFiles = new List<string>(),
-                contentFiles = new List<string>(),
-                embeddedFiles = new List<string>(),
-
-                binaryLibs = new List<string>(),
-                pkgLibs = new List<string>(),
-                systemLibs = new List<string>(),
-                runtimeLibs = new List<string>(),
-
-                extraDistFiles = new List<string>(),
-                localCopyTargets = new List<string>();
-
-            // If there exists a .config file for this assembly, copy
-            // it to the project folder
-
-            // TODO: Support copying .config.osx files
-            // TODO: support processing the .config file for native library deps
-            string projectAssemblyName = project.Name;
-            if (project.AssemblyName != null)
-                projectAssemblyName = project.AssemblyName;
-
-            if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
-            {
-                hasAssemblyConfig = true;
-                System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
-                extraDistFiles.Add(project.AssemblyName + ".dll.config");
-            }
-
-            foreach (ConfigurationNode conf in project.Configurations)
-            {
-                if (conf.Options.KeyFile != string.Empty)
-                {
-                    // Copy snk file into the project's directory
-                    // Use the snk from the project directory directly
-                    string source = Path.Combine(project.FullPath, conf.Options.KeyFile);
-                    string keyFile = conf.Options.KeyFile;
-                    Regex re = new Regex(".*/");
-                    keyFile = re.Replace(keyFile, "");
-
-                    string dest = Path.Combine(projectDir, keyFile);
-                    // Tell the user if there's a problem copying the file
-                    try
-                    {
-                        mkdirDashP(System.IO.Path.GetDirectoryName(dest));
-                        System.IO.File.Copy(source, dest, true);
-                    }
-                    catch (System.IO.IOException e)
-                    {
-                        Console.WriteLine(e.Message);
-                    }
-                }
-            }
-
-            // Copy compiled, embedded and content files into the project's directory
-            foreach (string filename in project.Files)
-            {
-                string source = Path.Combine(project.FullPath, filename);
-                string dest = Path.Combine(projectDir, filename);
-
-                if (filename.Contains("AssemblyInfo.cs"))
-                {
-                    // If we've got an AssemblyInfo.cs, pull the version number from it
-                    string[] sources = { source };
-                    string[] args = { "" };
-                    Microsoft.CSharp.CSharpCodeProvider cscp =
-                        new Microsoft.CSharp.CSharpCodeProvider();
-
-                    string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
-                    System.CodeDom.Compiler.CompilerParameters cparam =
-                        new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
-                    
-                    System.CodeDom.Compiler.CompilerResults cr =
-                        cscp.CompileAssemblyFromFile(cparam, sources);
-
-                    foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
-                        Console.WriteLine("Error! '{0}'", error.ErrorText);
-
-                    try {
-                      string projectFullName = cr.CompiledAssembly.FullName;
-                      Regex verRegex = new Regex("Version=([\\d\\.]+)");
-                      Match verMatch = verRegex.Match(projectFullName);
-                      if (verMatch.Success)
-                        projectVersion = verMatch.Groups[1].Value;
-                    }catch{
-                      Console.WriteLine("Couldn't compile AssemblyInfo.cs");
-                    }
-
-                    // Clean up the temp file
-                    try
-                    {
-                        if (File.Exists(tempAssemblyFile))
-                            File.Delete(tempAssemblyFile);
-                    }
-                    catch 
-                    {
-                        Console.WriteLine("Error! '{0}'", e);
-                    }
-                   
-                }
-
-                // Tell the user if there's a problem copying the file
-                try
-                {
-                    mkdirDashP(System.IO.Path.GetDirectoryName(dest));
-                    System.IO.File.Copy(source, dest, true);
-                }
-                catch (System.IO.IOException e)
-                {
-                    Console.WriteLine(e.Message);
-                }
-
-                switch (project.Files.GetBuildAction(filename))
-                {
-                    case BuildAction.Compile:
-                        compiledFiles.Add(filename);
-                        break;
-                    case BuildAction.Content:
-                        contentFiles.Add(filename);
-                        extraDistFiles.Add(filename);
-                        break;
-                    case BuildAction.EmbeddedResource:
-                        embeddedFiles.Add(filename);
-                        break;
-                }
-            }
-
-            // Set up references
-            for (int refNum = 0; refNum < project.References.Count; refNum++)
-            {
-                ReferenceNode refr = project.References[refNum];
-                Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
-
-                /* Determine which pkg-config (.pc) file refers to
-                   this assembly */
-
-                SystemPackage package = null;
-
-                if (packagesHash.ContainsKey(refr.Name))
-                {
-                  package = packagesHash[refr.Name];
-
-                }
-                else
-                {
-                    string assemblyFullName = string.Empty;
-                    if (refAssembly != null)
-                        assemblyFullName = refAssembly.FullName;
-
-                    string assemblyFileName = string.Empty;
-                    if (assemblyFullName != string.Empty &&
-                        assemblyFullNameToPath.ContainsKey(assemblyFullName)
-                        )
-                        assemblyFileName =
-                          assemblyFullNameToPath[assemblyFullName];
-
-                    if (assemblyFileName != string.Empty &&
-                        assemblyPathToPackage.ContainsKey(assemblyFileName)
-                        )
-                        package = assemblyPathToPackage[assemblyFileName];
-
-                }
-
-                /* If we know the .pc file and it is not "mono"
-                   (already in the path), add a -pkg: argument */
-
-                if (package != null &&
-                    package.Name != "mono" &&
-                    !pkgLibs.Contains(package.Name)
-                    )
-                    pkgLibs.Add(package.Name);
-
-                string fileRef =
-                  FindFileReference(refr.Name, (ProjectNode)refr.Parent);
-
-                if (refr.LocalCopy ||
-                    solution.ProjectsTable.ContainsKey(refr.Name) ||
-                    fileRef != null ||
-                    refr.Path != null
-                    )
-                {
-
-                    /* Attempt to copy the referenced lib to the
-                       project's directory */
-
-                    string filename = refr.Name + ".dll";
-                    string source = filename;
-                    if (refr.Path != null)
-                        source = Path.Combine(refr.Path, source);
-                    source = Path.Combine(project.FullPath, source);
-                    string dest = Path.Combine(projectDir, filename);
-
-                    /* Since we depend on this binary dll to build, we
-                     * will add a compile- time dependency on the
-                     * copied dll, and add the dll to the list of
-                     * files distributed with this package
-                     */
-
-                    binaryLibs.Add(refr.Name + ".dll");
-                    extraDistFiles.Add(refr.Name + ".dll");
-
-                    // TODO: Support copying .config.osx files
-                    // TODO: Support for determining native dependencies
-                    if (File.Exists(source + ".config"))
-                    {
-                        System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
-                        extraDistFiles.Add(refr.Name + ".dll.config");
-                    }
-
-                    try
-                    {
-                        System.IO.File.Copy(source, dest, true);
-                    }
-                    catch (System.IO.IOException)
-                    {
-                      if (solution.ProjectsTable.ContainsKey(refr.Name)){
-
-                        /* If an assembly is referenced, marked for
-                         * local copy, in the list of projects for
-                         * this solution, but does not exist, put a
-                         * target into the Makefile.am to build the
-                         * assembly and copy it to this project's
-                         * directory
-                         */
-
-                        ProjectNode sourcePrj =
-                          ((solution.ProjectsTable[refr.Name]));
-
-                        string target =
-                          String.Format("{0}:\n" +
-                                        "\t$(MAKE) -C ../{1}\n" +
-                                        "\tln ../{2}/$@ $@\n",
-                                        filename,
-                                        sourcePrj.Name,
-                                        sourcePrj.Name );
-
-                        localCopyTargets.Add(target);
-                      }
-                    }
-                }
-                else if( !pkgLibs.Contains(refr.Name) )
-                {
-                    // Else, let's assume it's in the GAC or the lib path
-                    string assemName = string.Empty;
-                    int index = refr.Name.IndexOf(",");
-
-                    if (index > 0)
-                        assemName = refr.Name.Substring(0, index);
-                    else
-                        assemName = refr.Name;
-
-                    m_Kernel.Log.Write(String.Format(
-                    "Warning: Couldn't find an appropriate assembly " +
-                    "for reference:\n'{0}'", refr.Name
-                                                     ));
-                    systemLibs.Add(assemName);
-                }
-            }
-
-            const string lineSep = " \\\n\t";
-            string compiledFilesString = string.Empty;
-            if (compiledFiles.Count > 0)
-                compiledFilesString =
-                    lineSep + string.Join(lineSep, compiledFiles.ToArray());
-
-            string embeddedFilesString = "";
-            if (embeddedFiles.Count > 0)
-                embeddedFilesString =
-                    lineSep + string.Join(lineSep, embeddedFiles.ToArray());
-
-            string contentFilesString = "";
-            if (contentFiles.Count > 0)
-                contentFilesString =
-                    lineSep + string.Join(lineSep, contentFiles.ToArray());
-
-            string extraDistFilesString = "";
-            if (extraDistFiles.Count > 0)
-                extraDistFilesString =
-                    lineSep + string.Join(lineSep, extraDistFiles.ToArray());
-
-            string pkgLibsString = "";
-            if (pkgLibs.Count > 0)
-                pkgLibsString =
-                    lineSep + string.Join(lineSep, pkgLibs.ToArray());
-
-            string binaryLibsString = "";
-            if (binaryLibs.Count > 0)
-                binaryLibsString =
-                    lineSep + string.Join(lineSep, binaryLibs.ToArray());
-
-            string systemLibsString = "";
-            if (systemLibs.Count > 0)
-                systemLibsString =
-                    lineSep + string.Join(lineSep, systemLibs.ToArray());
-
-            string localCopyTargetsString = "";
-            if (localCopyTargets.Count > 0)
-                localCopyTargetsString =
-                    string.Join("\n", localCopyTargets.ToArray());
-
-            string monoPath = "";
-            foreach (string runtimeLib in runtimeLibs)
-            {
-                monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
-            }
-
-            // Add the project name to the list of transformation
-            // parameters
-            XsltArgumentList argList = new XsltArgumentList();
-            argList.AddParam("projectName", "", project.Name);
-            argList.AddParam("solutionName", "", solution.Name);
-            argList.AddParam("assemblyName", "", projectAssemblyName);
-            argList.AddParam("compiledFiles", "", compiledFilesString);
-            argList.AddParam("embeddedFiles", "", embeddedFilesString);
-            argList.AddParam("contentFiles", "", contentFilesString);
-            argList.AddParam("extraDistFiles", "", extraDistFilesString);
-            argList.AddParam("pkgLibs", "", pkgLibsString);
-            argList.AddParam("binaryLibs", "", binaryLibsString);
-            argList.AddParam("systemLibs", "", systemLibsString);
-            argList.AddParam("monoPath", "", monoPath);
-            argList.AddParam("localCopyTargets", "", localCopyTargetsString);
-            argList.AddParam("projectVersion", "", projectVersion);
-            argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
-
-            // Transform the templates
-            transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
-            transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
-            transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
-
-            if (project.Type == Core.Nodes.ProjectType.Library)
-                transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
-            if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe)
-                transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
-        }
-
-        private void CleanProject(ProjectNode project)
-        {
-            m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
-            string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
-            Helper.DeleteIfExists(projectFile);
-        }
-
-        private void CleanSolution(SolutionNode solution)
-        {
-            m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
-
-            string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
-            Helper.DeleteIfExists(slnFile);
-
-            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
-            Helper.DeleteIfExists(slnFile);
-
-            foreach (ProjectNode project in solution.Projects)
-            {
-                CleanProject(project);
-            }
-
-            m_Kernel.Log.Write("");
-        }
-
-        #endregion
-
-        #region ITarget Members
-
-        /// <summary>
-        /// Writes the specified kern.
-        /// </summary>
-        /// <param name="kern">The kern.</param>
-        public void Write(Kernel kern)
-        {
-            if (kern == null)
-            {
-                throw new ArgumentNullException("kern");
-            }
-            m_Kernel = kern;
-            m_Kernel.Log.Write("Parsing system pkg-config files");
-            RunInitialization();
-
-            const string streamName = "autotools.xml";
-            string fqStreamName = String.Format("Prebuild.data.{0}",
-                                                streamName
-                                                );
-
-            // Retrieve stream for the autotools template XML
-            Stream autotoolsStream = Assembly.GetExecutingAssembly()
-                .GetManifestResourceStream(fqStreamName);
-
-            if(autotoolsStream == null) {
-
-              /* 
-               * try without the default namespace prepended, in
-               * case prebuild.exe assembly was compiled with
-               * something other than Visual Studio .NET
-               */
-
-              autotoolsStream = Assembly.GetExecutingAssembly()
-                .GetManifestResourceStream(streamName);
-              if(autotoolsStream == null){
-                string errStr =
-                  String.Format("Could not find embedded resource file:\n" +
-                                "'{0}' or '{1}'",
-                                streamName, fqStreamName
-                                );
-
-                m_Kernel.Log.Write(errStr);
-
-                throw new System.Reflection.TargetException(errStr);
-              }
-            }
-
-            // Create an XML URL Resolver with default credentials
-            xr = new System.Xml.XmlUrlResolver();
-            xr.Credentials = CredentialCache.DefaultCredentials;
-
-            // Create a default evidence - no need to limit access
-            e = new System.Security.Policy.Evidence();
-
-            // Load the autotools XML
-            autotoolsDoc = new XmlDocument();
-            autotoolsDoc.Load(autotoolsStream);
-
-            /* rootDir is the filesystem location where the Autotools
-             * build tree will be created - for now we'll make it
-             * $PWD/autotools
-             */
-
-            string pwd = Directory.GetCurrentDirectory();
-            //string pwd = System.Environment.GetEnvironmentVariable("PWD");
-            //if (pwd.Length != 0)
-            //{
-            string rootDir = Path.Combine(pwd, "autotools");
-            //}
-            //else
-            //{
-            //    pwd = Assembly.GetExecutingAssembly()
-            //}
-            chkMkDir(rootDir);
-
-            foreach (SolutionNode solution in kern.Solutions)
-            {
-              m_Kernel.Log.Write(String.Format("Writing solution: {0}",
-                                        solution.Name));
-              WriteCombine(solution);
-            }
-            m_Kernel = null;
-        }
-
-        /// <summary>
-        /// Cleans the specified kern.
-        /// </summary>
-        /// <param name="kern">The kern.</param>
-        public virtual void Clean(Kernel kern)
-        {
-            if (kern == null)
-            {
-                throw new ArgumentNullException("kern");
-            }
-            m_Kernel = kern;
-            foreach (SolutionNode sol in kern.Solutions)
-            {
-                CleanSolution(sol);
-            }
-            m_Kernel = null;
-        }
-
-        /// <summary>
-        /// Gets the name.
-        /// </summary>
-        /// <value>The name.</value>
-        public string Name
-        {
-            get
-            {
-                return "autotools";
-            }
-        }
-
-        #endregion
-    }
-}
+#region BSD License
+/*
+
+Copyright (c) 2004 - 2008
+Matthew Holmes        ([email protected]),
+Dan     Moorehead     ([email protected]),
+Dave    Hudson        ([email protected]),
+C.J.    Adams-Collier ([email protected]),
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+* Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+
+* The name of the author may not be used to endorse or promote
+products derived from this software without specific prior written
+permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+*/
+#endregion
+
+#region MIT X11 license
+
+/*
+ Portions of this file authored by Lluis Sanchez Gual
+
+ Copyright (C) 2006 Novell, Inc (http://www.novell.com)
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+ 
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ 
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#endregion
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Xml.Xsl;
+using System.Net;
+using System.Diagnostics;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+
+namespace Prebuild.Core.Targets
+{
+    public enum ClrVersion
+    {
+        Default,
+        Net_1_1,
+        Net_2_0
+    }
+
+    public class SystemPackage
+    {
+        string name;
+        string version;
+        string description;
+        string[] assemblies;
+        bool isInternal;
+        ClrVersion targetVersion;
+
+        public void Initialize(string name,
+                               string version,
+                               string description,
+                               string[] assemblies,
+                               ClrVersion targetVersion,
+                               bool isInternal)
+        {
+            this.isInternal = isInternal;
+            this.name = name;
+            this.version = version;
+            this.assemblies = assemblies;
+            this.description = description;
+            this.targetVersion = targetVersion;
+        }
+
+        public string Name
+        {
+            get { return name; }
+        }
+
+        public string Version
+        {
+            get { return version; }
+        }
+
+        public string Description
+        {
+            get { return description; }
+        }
+
+        public ClrVersion TargetVersion
+        {
+            get { return targetVersion; }
+        }
+
+        // The package is part of the mono SDK
+        public bool IsCorePackage
+        {
+            get { return name == "mono"; }
+        }
+
+        // The package has been registered by an add-in, and is not installed
+        // in the system.
+        public bool IsInternalPackage
+        {
+            get { return isInternal; }
+        }
+
+        public string[] Assemblies
+        {
+            get { return assemblies; }
+        }
+
+    }
+
+
+    /// <summary>
+    /// 
+    /// </summary>
+    [Target("autotools")]
+    public class AutotoolsTarget : ITarget
+    {
+        #region Fields
+
+        Kernel m_Kernel;
+        XmlDocument autotoolsDoc;
+        XmlUrlResolver xr;
+        System.Security.Policy.Evidence e;
+        readonly Dictionary<string, SystemPackage> assemblyPathToPackage = new Dictionary<string, SystemPackage>();
+        readonly Dictionary<string, string> assemblyFullNameToPath = new Dictionary<string, string>();
+        readonly Dictionary<string, SystemPackage> packagesHash = new Dictionary<string, SystemPackage>();
+        readonly List<SystemPackage> packages = new List<SystemPackage>();
+
+        #endregion
+
+        #region Private Methods
+
+        private static void mkdirDashP(string dirName)
+        {
+            DirectoryInfo di = new DirectoryInfo(dirName);
+            if (di.Exists)
+                return;
+
+            string parentDirName = System.IO.Path.GetDirectoryName(dirName);
+            DirectoryInfo parentDi = new DirectoryInfo(parentDirName);
+            if (!parentDi.Exists)
+                mkdirDashP(parentDirName);
+
+            di.Create();
+        }
+
+        private static void chkMkDir(string dirName)
+        {
+            System.IO.DirectoryInfo di =
+                new System.IO.DirectoryInfo(dirName);
+
+            if (!di.Exists)
+                di.Create();
+        }
+
+        private void transformToFile(string filename, XsltArgumentList argList, string nodeName)
+        {
+            // Create an XslTransform for this file
+            XslTransform templateTransformer =
+                new XslTransform();
+
+            // Load up the template
+            XmlNode templateNode =
+                autotoolsDoc.SelectSingleNode(nodeName + "/*");
+            templateTransformer.Load(templateNode.CreateNavigator(), xr, e);
+
+            // Create a writer for the transformed template
+            XmlTextWriter templateWriter =
+                new XmlTextWriter(filename, null);
+
+            // Perform transformation, writing the file
+            templateTransformer.Transform
+                (m_Kernel.CurrentDoc, argList, templateWriter, xr);
+        }
+
+        static string NormalizeAsmName(string name)
+        {
+            int i = name.IndexOf(", PublicKeyToken=null");
+            if (i != -1)
+                return name.Substring(0, i).Trim();
+            return name;
+        }
+
+        private void AddAssembly(string assemblyfile, SystemPackage package)
+        {
+            if (!File.Exists(assemblyfile))
+                return;
+
+            try
+            {
+                System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile);
+                assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile;
+                assemblyPathToPackage[assemblyfile] = package;
+            }
+            catch
+            {
+            }
+        }
+
+        private static List<string> GetAssembliesWithLibInfo(string line, string file)
+        {
+            List<string> references = new List<string>();
+            List<string> libdirs = new List<string>();
+            List<string> retval = new List<string>();
+            foreach (string piece in line.Split(' '))
+            {
+                if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:"))
+                {
+                    references.Add(ProcessPiece(piece.Substring(3).Trim(), file));
+                }
+                else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:"))
+                {
+                    libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file));
+                }
+            }
+
+            foreach (string refrnc in references)
+            {
+                foreach (string libdir in libdirs)
+                {
+                    if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc))
+                    {
+                        retval.Add(libdir + Path.DirectorySeparatorChar + refrnc);
+                    }
+                }
+            }
+
+            return retval;
+        }
+
+        private static List<string> GetAssembliesWithoutLibInfo(string line, string file)
+        {
+            List<string> references = new List<string>();
+            foreach (string reference in line.Split(' '))
+            {
+                if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:"))
+                {
+                    string final_ref = reference.Substring(3).Trim();
+                    references.Add(ProcessPiece(final_ref, file));
+                }
+            }
+            return references;
+        }
+
+        private static string ProcessPiece(string piece, string pcfile)
+        {
+            int start = piece.IndexOf("${");
+            if (start == -1)
+                return piece;
+
+            int end = piece.IndexOf("}");
+            if (end == -1)
+                return piece;
+
+            string variable = piece.Substring(start + 2, end - start - 2);
+            string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile));
+            return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile);
+        }
+
+        private static string GetVariableFromPkgConfig(string var, string pcfile)
+        {
+            ProcessStartInfo psi = new ProcessStartInfo("pkg-config");
+            psi.RedirectStandardOutput = true;
+            psi.UseShellExecute = false;
+            psi.Arguments = String.Format("--variable={0} {1}", var, pcfile);
+            Process p = new Process();
+            p.StartInfo = psi;
+            p.Start();
+            string ret = p.StandardOutput.ReadToEnd().Trim();
+            p.WaitForExit();
+            if (String.IsNullOrEmpty(ret))
+                return String.Empty;
+            return ret;
+        }
+
+        private void ParsePCFile(string pcfile)
+        {
+            // Don't register the package twice
+            string pname = Path.GetFileNameWithoutExtension(pcfile);
+            if (packagesHash.ContainsKey(pname))
+                return;
+
+            List<string> fullassemblies = null;
+            string version = "";
+            string desc = "";
+
+            SystemPackage package = new SystemPackage();
+
+            using (StreamReader reader = new StreamReader(pcfile))
+            {
+                string line;
+                while ((line = reader.ReadLine()) != null)
+                {
+                    string lowerLine = line.ToLower();
+                    if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1)
+                    {
+                        string choppedLine = line.Substring(5).Trim();
+                        if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1)
+                        {
+                            fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile);
+                        }
+                        else
+                        {
+                            fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile);
+                        }
+                    }
+                    else if (lowerLine.StartsWith("version:"))
+                    {
+                        // "version:".Length == 8
+                        version = line.Substring(8).Trim();
+                    }
+                    else if (lowerLine.StartsWith("description:"))
+                    {
+                        // "description:".Length == 12
+                        desc = line.Substring(12).Trim();
+                    }
+                }
+            }
+
+            if (fullassemblies == null)
+                return;
+
+            foreach (string assembly in fullassemblies)
+            {
+                AddAssembly(assembly, package);
+            }
+
+            package.Initialize(pname,
+                               version,
+                               desc,
+                               fullassemblies.ToArray(),
+                               ClrVersion.Default,
+                               false);
+            packages.Add(package);
+            packagesHash[pname] = package;
+        }
+
+        void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver)
+        {
+            SystemPackage package = new SystemPackage();
+            List<string> list = new List<string>();
+
+            string dir = Path.Combine(prefix, version);
+            if (!Directory.Exists(dir))
+            {
+                return;
+            }
+
+            foreach (string assembly in Directory.GetFiles(dir, "*.dll"))
+            {
+                AddAssembly(assembly, package);
+                list.Add(assembly);
+            }
+
+            package.Initialize("mono",
+                               version,
+                               "The Mono runtime",
+                               list.ToArray(),
+                               ver,
+                               false);
+            packages.Add(package);
+        }
+
+        void RunInitialization()
+        {
+            string versionDir;
+
+            if (Environment.Version.Major == 1)
+            {
+                versionDir = "1.0";
+            }
+            else
+            {
+                versionDir = "2.0";
+            }
+
+            //Pull up assemblies from the installed mono system.
+            string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location);
+
+            if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1)
+                prefix = Path.Combine(prefix, "mono");
+            else
+                prefix = Path.GetDirectoryName(prefix);
+
+            RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1);
+            RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0);
+
+            string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH");
+            string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH");
+
+            if (String.IsNullOrEmpty(libpath))
+            {
+                string path_dirs = Environment.GetEnvironmentVariable("PATH");
+                foreach (string pathdir in path_dirs.Split(Path.PathSeparator))
+                {
+                    if (pathdir == null)
+                        continue;
+                    if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config"))
+                    {
+                        libpath = Path.Combine(pathdir, "..");
+                        libpath = Path.Combine(libpath, "lib");
+                        libpath = Path.Combine(libpath, "pkgconfig");
+                        break;
+                    }
+                }
+            }
+            search_dirs += Path.PathSeparator + libpath;
+            if (!string.IsNullOrEmpty(search_dirs))
+            {
+                List<string> scanDirs = new List<string>();
+                foreach (string potentialDir in search_dirs.Split(Path.PathSeparator))
+                {
+                    if (!scanDirs.Contains(potentialDir))
+                        scanDirs.Add(potentialDir);
+                }
+                foreach (string pcdir in scanDirs)
+                {
+                    if (pcdir == null)
+                        continue;
+
+                    if (Directory.Exists(pcdir))
+                    {
+                        foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc"))
+                        {
+                            ParsePCFile(pcfile);
+                        }
+                    }
+                }
+            }
+        }
+
+        private void WriteCombine(SolutionNode solution)
+        {
+            #region "Create Solution directory if it doesn't exist"
+            string solutionDir = Path.Combine(solution.FullPath,
+                                              Path.Combine("autotools",
+                                                           solution.Name));
+            chkMkDir(solutionDir);
+            #endregion
+
+            #region "Write Solution-level files"
+            XsltArgumentList argList = new XsltArgumentList();
+            argList.AddParam("solutionName", "", solution.Name);
+            // $solutionDir is $rootDir/$solutionName/
+            transformToFile(Path.Combine(solutionDir, "configure.ac"),
+                            argList, "/Autotools/SolutionConfigureAc");
+            transformToFile(Path.Combine(solutionDir, "Makefile.am"),
+                            argList, "/Autotools/SolutionMakefileAm");
+            transformToFile(Path.Combine(solutionDir, "autogen.sh"),
+                            argList, "/Autotools/SolutionAutogenSh");
+            #endregion
+
+            foreach (ProjectNode project in solution.ProjectsTableOrder)
+            {
+              m_Kernel.Log.Write(String.Format("Writing project: {0}",
+                                               project.Name));
+              WriteProject(solution, project);
+            }
+        }
+
+        private static string FindFileReference(string refName,
+                                                ProjectNode project)
+        {
+            foreach (ReferencePathNode refPath in project.ReferencePaths)
+            {
+              string fullPath =
+                Helper.MakeFilePath(refPath.Path, refName, "dll");
+
+              if (File.Exists(fullPath)) {
+                return fullPath;
+              }
+            }
+
+            return null;
+        }
+
+        /// <summary>
+        /// Gets the XML doc file.
+        /// </summary>
+        /// <param name="project">The project.</param>
+        /// <param name="conf">The conf.</param>
+        /// <returns></returns>
+        public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
+        {
+            if (conf == null)
+            {
+                throw new ArgumentNullException("conf");
+            }
+            if (project == null)
+            {
+                throw new ArgumentNullException("project");
+            }
+            string docFile = (string)conf.Options["XmlDocFile"];
+            //			if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
+            //			{
+            //				return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
+            //			}
+            return docFile;
+        }
+
+        /// <summary>
+        /// Normalizes the path.
+        /// </summary>
+        /// <param name="path">The path.</param>
+        /// <returns></returns>
+        public static string NormalizePath(string path)
+        {
+            if (path == null)
+            {
+                return "";
+            }
+
+            StringBuilder tmpPath;
+
+            if (Core.Parse.Preprocessor.GetOS() == "Win32")
+            {
+                tmpPath = new StringBuilder(path.Replace('\\', '/'));
+                tmpPath.Replace("/", @"\\");
+            }
+            else
+            {
+                tmpPath = new StringBuilder(path.Replace('\\', '/'));
+                tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar);
+            }
+            return tmpPath.ToString();
+        }
+
+        private void WriteProject(SolutionNode solution, ProjectNode project)
+        {
+            string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name));
+            string projectDir = Path.Combine(solutionDir, project.Name);
+            string projectVersion = project.Version;
+            bool hasAssemblyConfig = false;
+            chkMkDir(projectDir);
+
+            List<string>
+                compiledFiles = new List<string>(),
+                contentFiles = new List<string>(),
+                embeddedFiles = new List<string>(),
+
+                binaryLibs = new List<string>(),
+                pkgLibs = new List<string>(),
+                systemLibs = new List<string>(),
+                runtimeLibs = new List<string>(),
+
+                extraDistFiles = new List<string>(),
+                localCopyTargets = new List<string>();
+
+            // If there exists a .config file for this assembly, copy
+            // it to the project folder
+
+            // TODO: Support copying .config.osx files
+            // TODO: support processing the .config file for native library deps
+            string projectAssemblyName = project.Name;
+            if (project.AssemblyName != null)
+                projectAssemblyName = project.AssemblyName;
+
+            if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config"))
+            {
+                hasAssemblyConfig = true;
+                System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true);
+                extraDistFiles.Add(project.AssemblyName + ".dll.config");
+            }
+
+            foreach (ConfigurationNode conf in project.Configurations)
+            {
+                if (conf.Options.KeyFile != string.Empty)
+                {
+                    // Copy snk file into the project's directory
+                    // Use the snk from the project directory directly
+                    string source = Path.Combine(project.FullPath, conf.Options.KeyFile);
+                    string keyFile = conf.Options.KeyFile;
+                    Regex re = new Regex(".*/");
+                    keyFile = re.Replace(keyFile, "");
+
+                    string dest = Path.Combine(projectDir, keyFile);
+                    // Tell the user if there's a problem copying the file
+                    try
+                    {
+                        mkdirDashP(System.IO.Path.GetDirectoryName(dest));
+                        System.IO.File.Copy(source, dest, true);
+                    }
+                    catch (System.IO.IOException e)
+                    {
+                        Console.WriteLine(e.Message);
+                    }
+                }
+            }
+
+            // Copy compiled, embedded and content files into the project's directory
+            foreach (string filename in project.Files)
+            {
+                string source = Path.Combine(project.FullPath, filename);
+                string dest = Path.Combine(projectDir, filename);
+
+                if (filename.Contains("AssemblyInfo.cs"))
+                {
+                    // If we've got an AssemblyInfo.cs, pull the version number from it
+                    string[] sources = { source };
+                    string[] args = { "" };
+                    Microsoft.CSharp.CSharpCodeProvider cscp =
+                        new Microsoft.CSharp.CSharpCodeProvider();
+
+                    string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll");
+                    System.CodeDom.Compiler.CompilerParameters cparam =
+                        new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile);
+                    
+                    System.CodeDom.Compiler.CompilerResults cr =
+                        cscp.CompileAssemblyFromFile(cparam, sources);
+
+                    foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors)
+                        Console.WriteLine("Error! '{0}'", error.ErrorText);
+
+                    try {
+                      string projectFullName = cr.CompiledAssembly.FullName;
+                      Regex verRegex = new Regex("Version=([\\d\\.]+)");
+                      Match verMatch = verRegex.Match(projectFullName);
+                      if (verMatch.Success)
+                        projectVersion = verMatch.Groups[1].Value;
+                    }catch{
+                      Console.WriteLine("Couldn't compile AssemblyInfo.cs");
+                    }
+
+                    // Clean up the temp file
+                    try
+                    {
+                        if (File.Exists(tempAssemblyFile))
+                            File.Delete(tempAssemblyFile);
+                    }
+                    catch 
+                    {
+                        Console.WriteLine("Error! '{0}'", e);
+                    }
+                   
+                }
+
+                // Tell the user if there's a problem copying the file
+                try
+                {
+                    mkdirDashP(System.IO.Path.GetDirectoryName(dest));
+                    System.IO.File.Copy(source, dest, true);
+                }
+                catch (System.IO.IOException e)
+                {
+                    Console.WriteLine(e.Message);
+                }
+
+                switch (project.Files.GetBuildAction(filename))
+                {
+                    case BuildAction.Compile:
+                        compiledFiles.Add(filename);
+                        break;
+                    case BuildAction.Content:
+                        contentFiles.Add(filename);
+                        extraDistFiles.Add(filename);
+                        break;
+                    case BuildAction.EmbeddedResource:
+                        embeddedFiles.Add(filename);
+                        break;
+                }
+            }
+
+            // Set up references
+            for (int refNum = 0; refNum < project.References.Count; refNum++)
+            {
+                ReferenceNode refr = project.References[refNum];
+                Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name);
+
+                /* Determine which pkg-config (.pc) file refers to
+                   this assembly */
+
+                SystemPackage package = null;
+
+                if (packagesHash.ContainsKey(refr.Name))
+                {
+                  package = packagesHash[refr.Name];
+
+                }
+                else
+                {
+                    string assemblyFullName = string.Empty;
+                    if (refAssembly != null)
+                        assemblyFullName = refAssembly.FullName;
+
+                    string assemblyFileName = string.Empty;
+                    if (assemblyFullName != string.Empty &&
+                        assemblyFullNameToPath.ContainsKey(assemblyFullName)
+                        )
+                        assemblyFileName =
+                          assemblyFullNameToPath[assemblyFullName];
+
+                    if (assemblyFileName != string.Empty &&
+                        assemblyPathToPackage.ContainsKey(assemblyFileName)
+                        )
+                        package = assemblyPathToPackage[assemblyFileName];
+
+                }
+
+                /* If we know the .pc file and it is not "mono"
+                   (already in the path), add a -pkg: argument */
+
+                if (package != null &&
+                    package.Name != "mono" &&
+                    !pkgLibs.Contains(package.Name)
+                    )
+                    pkgLibs.Add(package.Name);
+
+                string fileRef =
+                  FindFileReference(refr.Name, (ProjectNode)refr.Parent);
+
+                if (refr.LocalCopy ||
+                    solution.ProjectsTable.ContainsKey(refr.Name) ||
+                    fileRef != null ||
+                    refr.Path != null
+                    )
+                {
+
+                    /* Attempt to copy the referenced lib to the
+                       project's directory */
+
+                    string filename = refr.Name + ".dll";
+                    string source = filename;
+                    if (refr.Path != null)
+                        source = Path.Combine(refr.Path, source);
+                    source = Path.Combine(project.FullPath, source);
+                    string dest = Path.Combine(projectDir, filename);
+
+                    /* Since we depend on this binary dll to build, we
+                     * will add a compile- time dependency on the
+                     * copied dll, and add the dll to the list of
+                     * files distributed with this package
+                     */
+
+                    binaryLibs.Add(refr.Name + ".dll");
+                    extraDistFiles.Add(refr.Name + ".dll");
+
+                    // TODO: Support copying .config.osx files
+                    // TODO: Support for determining native dependencies
+                    if (File.Exists(source + ".config"))
+                    {
+                        System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true);
+                        extraDistFiles.Add(refr.Name + ".dll.config");
+                    }
+
+                    try
+                    {
+                        System.IO.File.Copy(source, dest, true);
+                    }
+                    catch (System.IO.IOException)
+                    {
+                      if (solution.ProjectsTable.ContainsKey(refr.Name)){
+
+                        /* If an assembly is referenced, marked for
+                         * local copy, in the list of projects for
+                         * this solution, but does not exist, put a
+                         * target into the Makefile.am to build the
+                         * assembly and copy it to this project's
+                         * directory
+                         */
+
+                        ProjectNode sourcePrj =
+                          ((solution.ProjectsTable[refr.Name]));
+
+                        string target =
+                          String.Format("{0}:\n" +
+                                        "\t$(MAKE) -C ../{1}\n" +
+                                        "\tln ../{2}/$@ $@\n",
+                                        filename,
+                                        sourcePrj.Name,
+                                        sourcePrj.Name );
+
+                        localCopyTargets.Add(target);
+                      }
+                    }
+                }
+                else if( !pkgLibs.Contains(refr.Name) )
+                {
+                    // Else, let's assume it's in the GAC or the lib path
+                    string assemName = string.Empty;
+                    int index = refr.Name.IndexOf(",");
+
+                    if (index > 0)
+                        assemName = refr.Name.Substring(0, index);
+                    else
+                        assemName = refr.Name;
+
+                    m_Kernel.Log.Write(String.Format(
+                    "Warning: Couldn't find an appropriate assembly " +
+                    "for reference:\n'{0}'", refr.Name
+                                                     ));
+                    systemLibs.Add(assemName);
+                }
+            }
+
+            const string lineSep = " \\\n\t";
+            string compiledFilesString = string.Empty;
+            if (compiledFiles.Count > 0)
+                compiledFilesString =
+                    lineSep + string.Join(lineSep, compiledFiles.ToArray());
+
+            string embeddedFilesString = "";
+            if (embeddedFiles.Count > 0)
+                embeddedFilesString =
+                    lineSep + string.Join(lineSep, embeddedFiles.ToArray());
+
+            string contentFilesString = "";
+            if (contentFiles.Count > 0)
+                contentFilesString =
+                    lineSep + string.Join(lineSep, contentFiles.ToArray());
+
+            string extraDistFilesString = "";
+            if (extraDistFiles.Count > 0)
+                extraDistFilesString =
+                    lineSep + string.Join(lineSep, extraDistFiles.ToArray());
+
+            string pkgLibsString = "";
+            if (pkgLibs.Count > 0)
+                pkgLibsString =
+                    lineSep + string.Join(lineSep, pkgLibs.ToArray());
+
+            string binaryLibsString = "";
+            if (binaryLibs.Count > 0)
+                binaryLibsString =
+                    lineSep + string.Join(lineSep, binaryLibs.ToArray());
+
+            string systemLibsString = "";
+            if (systemLibs.Count > 0)
+                systemLibsString =
+                    lineSep + string.Join(lineSep, systemLibs.ToArray());
+
+            string localCopyTargetsString = "";
+            if (localCopyTargets.Count > 0)
+                localCopyTargetsString =
+                    string.Join("\n", localCopyTargets.ToArray());
+
+            string monoPath = "";
+            foreach (string runtimeLib in runtimeLibs)
+            {
+                monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`";
+            }
+
+            // Add the project name to the list of transformation
+            // parameters
+            XsltArgumentList argList = new XsltArgumentList();
+            argList.AddParam("projectName", "", project.Name);
+            argList.AddParam("solutionName", "", solution.Name);
+            argList.AddParam("assemblyName", "", projectAssemblyName);
+            argList.AddParam("compiledFiles", "", compiledFilesString);
+            argList.AddParam("embeddedFiles", "", embeddedFilesString);
+            argList.AddParam("contentFiles", "", contentFilesString);
+            argList.AddParam("extraDistFiles", "", extraDistFilesString);
+            argList.AddParam("pkgLibs", "", pkgLibsString);
+            argList.AddParam("binaryLibs", "", binaryLibsString);
+            argList.AddParam("systemLibs", "", systemLibsString);
+            argList.AddParam("monoPath", "", monoPath);
+            argList.AddParam("localCopyTargets", "", localCopyTargetsString);
+            argList.AddParam("projectVersion", "", projectVersion);
+            argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : "");
+
+            // Transform the templates
+            transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc");
+            transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm");
+            transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh");
+
+            if (project.Type == Core.Nodes.ProjectType.Library)
+                transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn");
+            if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe)
+                transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn");
+        }
+
+        private void CleanProject(ProjectNode project)
+        {
+            m_Kernel.Log.Write("...Cleaning project: {0}", project.Name);
+            string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am");
+            Helper.DeleteIfExists(projectFile);
+        }
+
+        private void CleanSolution(SolutionNode solution)
+        {
+            m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name);
+
+            string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "configure");
+            Helper.DeleteIfExists(slnFile);
+
+            slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile");
+            Helper.DeleteIfExists(slnFile);
+
+            foreach (ProjectNode project in solution.Projects)
+            {
+                CleanProject(project);
+            }
+
+            m_Kernel.Log.Write("");
+        }
+
+        #endregion
+
+        #region ITarget Members
+
+        /// <summary>
+        /// Writes the specified kern.
+        /// </summary>
+        /// <param name="kern">The kern.</param>
+        public void Write(Kernel kern)
+        {
+            if (kern == null)
+            {
+                throw new ArgumentNullException("kern");
+            }
+            m_Kernel = kern;
+            m_Kernel.Log.Write("Parsing system pkg-config files");
+            RunInitialization();
+
+            const string streamName = "autotools.xml";
+            string fqStreamName = String.Format("Prebuild.data.{0}",
+                                                streamName
+                                                );
+
+            // Retrieve stream for the autotools template XML
+            Stream autotoolsStream = Assembly.GetExecutingAssembly()
+                .GetManifestResourceStream(fqStreamName);
+
+            if(autotoolsStream == null) {
+
+              /* 
+               * try without the default namespace prepended, in
+               * case prebuild.exe assembly was compiled with
+               * something other than Visual Studio .NET
+               */
+
+              autotoolsStream = Assembly.GetExecutingAssembly()
+                .GetManifestResourceStream(streamName);
+              if(autotoolsStream == null){
+                string errStr =
+                  String.Format("Could not find embedded resource file:\n" +
+                                "'{0}' or '{1}'",
+                                streamName, fqStreamName
+                                );
+
+                m_Kernel.Log.Write(errStr);
+
+                throw new System.Reflection.TargetException(errStr);
+              }
+            }
+
+            // Create an XML URL Resolver with default credentials
+            xr = new System.Xml.XmlUrlResolver();
+            xr.Credentials = CredentialCache.DefaultCredentials;
+
+            // Create a default evidence - no need to limit access
+            e = new System.Security.Policy.Evidence();
+
+            // Load the autotools XML
+            autotoolsDoc = new XmlDocument();
+            autotoolsDoc.Load(autotoolsStream);
+
+            /* rootDir is the filesystem location where the Autotools
+             * build tree will be created - for now we'll make it
+             * $PWD/autotools
+             */
+
+            string pwd = Directory.GetCurrentDirectory();
+            //string pwd = System.Environment.GetEnvironmentVariable("PWD");
+            //if (pwd.Length != 0)
+            //{
+            string rootDir = Path.Combine(pwd, "autotools");
+            //}
+            //else
+            //{
+            //    pwd = Assembly.GetExecutingAssembly()
+            //}
+            chkMkDir(rootDir);
+
+            foreach (SolutionNode solution in kern.Solutions)
+            {
+              m_Kernel.Log.Write(String.Format("Writing solution: {0}",
+                                        solution.Name));
+              WriteCombine(solution);
+            }
+            m_Kernel = null;
+        }
+
+        /// <summary>
+        /// Cleans the specified kern.
+        /// </summary>
+        /// <param name="kern">The kern.</param>
+        public virtual void Clean(Kernel kern)
+        {
+            if (kern == null)
+            {
+                throw new ArgumentNullException("kern");
+            }
+            m_Kernel = kern;
+            foreach (SolutionNode sol in kern.Solutions)
+            {
+                CleanSolution(sol);
+            }
+            m_Kernel = null;
+        }
+
+        /// <summary>
+        /// Gets the name.
+        /// </summary>
+        /// <value>The name.</value>
+        public string Name
+        {
+            get
+            {
+                return "autotools";
+            }
+        }
+
+        #endregion
+    }
+}

+ 138 - 138
Prebuild/src/Core/Targets/VS2010Target.cs

@@ -1,138 +1,138 @@
-using System;
-using System.IO;
-using System.Text;
-
-using Prebuild.Core.Attributes;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-using System.CodeDom.Compiler;
-
-namespace Prebuild.Core.Targets
-{
-
-	/// <summary>
-	/// 
-	/// </summary>
-	[Target("vs2010")]
-	public class VS2010Target : VSGenericTarget
-	{
-		#region Fields
-		
-		string solutionVersion = "11.00";
-		string productVersion = "9.0.30729";
-		string schemaVersion = "2.0";
-		string versionName = "Visual Studio 2010";
-		string name = "vs2010";
-		VSVersion version = VSVersion.VS10;
-
-		#endregion
-		
-		#region Properties
-		
-		/// <summary>
-		/// Gets or sets the solution version.
-		/// </summary>
-		/// <value>The solution version.</value>
-		public override string SolutionVersion
-		{
-			get
-			{
-				return solutionVersion;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the product version.
-		/// </summary>
-		/// <value>The product version.</value>
-		public override string ProductVersion
-		{
-			get
-			{
-				return productVersion;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the schema version.
-		/// </summary>
-		/// <value>The schema version.</value>
-		public override string SchemaVersion
-		{
-			get
-			{
-				return schemaVersion;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the name of the version.
-		/// </summary>
-		/// <value>The name of the version.</value>
-		public override string VersionName
-		{
-			get
-			{
-				return versionName;
-			}
-		}
-		
-		/// <summary>
-		/// Gets or sets the version.
-		/// </summary>
-		/// <value>The version.</value>
-		public override VSVersion Version
-		{
-			get
-			{
-				return version;
-			}
-		}
-		
-		/// <summary>
-		/// Gets the name.
-		/// </summary>
-		/// <value>The name.</value>
-		public override string Name
-		{
-			get
-			{
-				return name;
-			}
-		}
-
-        protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
-        {
-            switch (frameworkVersion)
-            {
-            	case FrameworkVersion.v4_0:
-                case FrameworkVersion.v3_5:
-            		return "ToolsVersion=\"4.0\"";
-                case FrameworkVersion.v3_0:
-                    return "ToolsVersion=\"3.0\"";
-                default:
-                    return "ToolsVersion=\"2.0\"";
-            }
-        }
-
-        public override string SolutionTag
-        {
-            get { return "# Visual Studio 2010"; }
-        }
-
-	    #endregion
-
-		#region Constructors
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="VS2005Target"/> class.
-		/// </summary>
-		public VS2010Target()
-			: base()
-		{
-		}
-
-		#endregion
-	}
-}
+using System;
+using System.IO;
+using System.Text;
+
+using Prebuild.Core.Attributes;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+using System.CodeDom.Compiler;
+
+namespace Prebuild.Core.Targets
+{
+
+	/// <summary>
+	/// 
+	/// </summary>
+	[Target("vs2010")]
+	public class VS2010Target : VSGenericTarget
+	{
+		#region Fields
+		
+		string solutionVersion = "11.00";
+		string productVersion = "9.0.30729";
+		string schemaVersion = "2.0";
+		string versionName = "Visual Studio 2010";
+		string name = "vs2010";
+		VSVersion version = VSVersion.VS10;
+
+		#endregion
+		
+		#region Properties
+		
+		/// <summary>
+		/// Gets or sets the solution version.
+		/// </summary>
+		/// <value>The solution version.</value>
+		public override string SolutionVersion
+		{
+			get
+			{
+				return solutionVersion;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the product version.
+		/// </summary>
+		/// <value>The product version.</value>
+		public override string ProductVersion
+		{
+			get
+			{
+				return productVersion;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the schema version.
+		/// </summary>
+		/// <value>The schema version.</value>
+		public override string SchemaVersion
+		{
+			get
+			{
+				return schemaVersion;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the name of the version.
+		/// </summary>
+		/// <value>The name of the version.</value>
+		public override string VersionName
+		{
+			get
+			{
+				return versionName;
+			}
+		}
+		
+		/// <summary>
+		/// Gets or sets the version.
+		/// </summary>
+		/// <value>The version.</value>
+		public override VSVersion Version
+		{
+			get
+			{
+				return version;
+			}
+		}
+		
+		/// <summary>
+		/// Gets the name.
+		/// </summary>
+		/// <value>The name.</value>
+		public override string Name
+		{
+			get
+			{
+				return name;
+			}
+		}
+
+        protected override string GetToolsVersionXml(FrameworkVersion frameworkVersion)
+        {
+            switch (frameworkVersion)
+            {
+            	case FrameworkVersion.v4_0:
+                case FrameworkVersion.v3_5:
+            		return "ToolsVersion=\"4.0\"";
+                case FrameworkVersion.v3_0:
+                    return "ToolsVersion=\"3.0\"";
+                default:
+                    return "ToolsVersion=\"2.0\"";
+            }
+        }
+
+        public override string SolutionTag
+        {
+            get { return "# Visual Studio 2010"; }
+        }
+
+	    #endregion
+
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="VS2005Target"/> class.
+		/// </summary>
+		public VS2010Target()
+			: base()
+		{
+		}
+
+		#endregion
+	}
+}

+ 922 - 922
Prebuild/src/Core/Targets/VSGenericTarget.cs

@@ -1,922 +1,922 @@
-#region BSD License
-/*
-Copyright (c) 2008 Matthew Holmes ([email protected]), John Anderson ([email protected])
-
-Redistribution and use in source and binary forms, with or without modification, are permitted
-provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this list of conditions
-  and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
-  and the following disclaimer in the documentation and/or other materials provided with the
-  distribution.
- * The name of the author may not be used to endorse or promote products derived from this software
-  without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
-IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#endregion
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using Prebuild.Core.Interfaces;
-using Prebuild.Core.Nodes;
-using Prebuild.Core.Utilities;
-using System.CodeDom.Compiler;
-
-namespace Prebuild.Core.Targets
-{
-
-	/// <summary>
-	/// 
-	/// </summary>
-	public abstract class VSGenericTarget : ITarget
-	{
-		#region Fields
-
-		readonly Dictionary<string, ToolInfo> tools = new Dictionary<string, ToolInfo>();
-		Kernel kernel;
-		#endregion
-
-		#region Properties
-		/// <summary>
-		/// Gets or sets the solution version.
-		/// </summary>
-		/// <value>The solution version.</value>
-		public abstract string SolutionVersion { get; }
-		/// <summary>
-		/// Gets or sets the product version.
-		/// </summary>
-		/// <value>The product version.</value>
-		public abstract string ProductVersion { get; }
-		/// <summary>
-		/// Gets or sets the schema version.
-		/// </summary>
-		/// <value>The schema version.</value>
-		public abstract string SchemaVersion { get; }
-		/// <summary>
-		/// Gets or sets the name of the version.
-		/// </summary>
-		/// <value>The name of the version.</value>
-		public abstract string VersionName { get; }
-		/// <summary>
-		/// Gets or sets the version.
-		/// </summary>
-		/// <value>The version.</value>
-		public abstract VSVersion Version { get; }
-		/// <summary>
-		/// Gets the name.
-		/// </summary>
-		/// <value>The name.</value>
-		public abstract string Name { get; }
-
-		protected abstract string GetToolsVersionXml(FrameworkVersion version);
-		public abstract string SolutionTag { get; }
-
-		#endregion
-
-		#region Constructors
-
-		/// <summary>
-		/// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
-		/// </summary>
-		protected VSGenericTarget()
-		{
-			tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
-			tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
-			tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
-			tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
-			tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
-		}
-
-		#endregion
-
-		#region Private Methods
-
-		private string MakeRefPath(ProjectNode project)
-		{
-			string ret = "";
-			foreach (ReferencePathNode node in project.ReferencePaths)
-			{
-				try
-				{
-					string fullPath = Helper.ResolvePath(node.Path);
-					if (ret.Length < 1)
-					{
-						ret = fullPath;
-					}
-					else
-					{
-						ret += ";" + fullPath;
-					}
-				}
-				catch (ArgumentException)
-				{
-					kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
-				}
-			}
-
-			return ret;
-		}
-
-		private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
-		{
-			SolutionNode node = solution;
-
-			while (node.Parent is SolutionNode)
-				node = node.Parent as SolutionNode;
-
-			return FindProjectInSolutionRecursively(name, node);
-		}
-
-		private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
-		{
-			if (solution.ProjectsTable.ContainsKey(name))
-				return solution.ProjectsTable[name];
-
-			foreach (SolutionNode child in solution.Solutions)
-			{
-				ProjectNode node = FindProjectInSolutionRecursively(name, child);
-				if (node != null)
-					return node;
-			}
-
-			return null;
-		}
-
-		private void WriteProject(SolutionNode solution, ProjectNode project)
-		{
-			if (!tools.ContainsKey(project.Language))
-			{
-				throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
-			}
-
-			ToolInfo toolInfo = tools[project.Language];
-			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
-			StreamWriter ps = new StreamWriter(projectFile);
-
-			kernel.CurrentWorkingDirectory.Push();
-			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
-
-			#region Project File
-			using (ps)
-			{
-				ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
-				ps.WriteLine("	<PropertyGroup>");
-				ps.WriteLine("	  <ProjectType>Local</ProjectType>");
-				ps.WriteLine("	  <ProductVersion>{0}</ProductVersion>", ProductVersion);
-				ps.WriteLine("	  <SchemaVersion>{0}</SchemaVersion>", SchemaVersion);
-				ps.WriteLine("	  <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
-
-				// Visual Studio has a hard coded guid for the project type
-				if (project.Type == ProjectType.Web)
-					ps.WriteLine("	  <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
-				ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
-				ps.WriteLine("	  <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
-				ps.WriteLine("	  <AssemblyKeyContainerName>");
-				ps.WriteLine("	  </AssemblyKeyContainerName>");
-				ps.WriteLine("	  <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
-				foreach (ConfigurationNode conf in project.Configurations)
-				{
-					if (conf.Options.KeyFile != "")
-					{
-						ps.WriteLine("	  <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
-						ps.WriteLine("	  <SignAssembly>true</SignAssembly>");
-						break;
-					}
-				}
-				ps.WriteLine("	  <DefaultClientScript>JScript</DefaultClientScript>");
-				ps.WriteLine("	  <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
-				ps.WriteLine("	  <DefaultTargetSchema>IE50</DefaultTargetSchema>");
-				ps.WriteLine("	  <DelaySign>false</DelaySign>");
-				ps.WriteLine("	  <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
-
-				ps.WriteLine("	  <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
-				ps.WriteLine("	  <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
-				ps.WriteLine("	  <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
-				ps.WriteLine("	  <StartupObject>{0}</StartupObject>", project.StartupObject);
-				if (string.IsNullOrEmpty(project.DebugStartParameters))
-				{
-					ps.WriteLine("	  <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
-				}
-				ps.WriteLine("	  <FileUpgradeFlags>");
-				ps.WriteLine("	  </FileUpgradeFlags>");
-
-				ps.WriteLine("	</PropertyGroup>");
-
-				foreach (ConfigurationNode conf in project.Configurations)
-				{
-					ps.Write("	<PropertyGroup ");
-					ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
-					ps.WriteLine("	  <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
-					ps.WriteLine("	  <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
-					ps.WriteLine("	  <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
-					ps.WriteLine("	  <ConfigurationOverrideFile>");
-					ps.WriteLine("	  </ConfigurationOverrideFile>");
-					ps.WriteLine("	  <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
-					ps.WriteLine("	  <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
-					ps.WriteLine("	  <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
-					ps.WriteLine("	  <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
-					ps.WriteLine("	  <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
-					if (project.Type != ProjectType.Web)
-						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
-						             Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
-					else
-						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
-						             Helper.EndPath(Helper.NormalizePath("bin\\")));
-
-					ps.WriteLine("	  <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
-					ps.WriteLine("	  <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
-					ps.WriteLine("	  <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
-					ps.WriteLine("	  <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
-					ps.WriteLine("	  <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
-					ps.WriteLine("	  <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
-					ps.WriteLine("	  <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
-					ps.WriteLine("	</PropertyGroup>");
-				}
-
-				//ps.WriteLine("	  </Settings>");
-
-				Dictionary<ReferenceNode, ProjectNode> projectReferences = new Dictionary<ReferenceNode, ProjectNode>();
-				List<ReferenceNode> otherReferences = new List<ReferenceNode>();
-
-				foreach (ReferenceNode refr in project.References)
-				{
-					ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
-
-					if (projectNode == null)
-						otherReferences.Add(refr);
-					else
-						projectReferences.Add(refr, projectNode);
-				}
-				// Assembly References
-				ps.WriteLine("	<ItemGroup>");
-
-				foreach (ReferenceNode refr in otherReferences)
-				{
-					ps.Write("	  <Reference");
-					ps.Write(" Include=\"");
-					ps.Write(refr.Name);
-					ps.WriteLine("\" >");
-					ps.Write("		  <Name>");
-					ps.Write(refr.Name);
-					ps.WriteLine("</Name>");
-										
-					if(!String.IsNullOrEmpty(refr.Path))
-					{
-						// Use absolute path to assembly (for determining assembly type)
-						string absolutePath = Path.Combine(project.FullPath, refr.Path);
-						if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
-							// Assembly is an executable (exe)
-							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
-						} else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
-							// Assembly is an library (dll)							
-							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
-						} else {
-							string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
-							kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
-							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
-						}
-					}
-					
-					ps.WriteLine("		<Private>{0}</Private>", refr.LocalCopy);
-					ps.WriteLine("	  </Reference>");
-				}
-				ps.WriteLine("	</ItemGroup>");
-
-				//Project References
-				ps.WriteLine("	<ItemGroup>");
-				foreach (KeyValuePair<ReferenceNode, ProjectNode> pair in projectReferences)
-				{
-					ToolInfo tool = tools[pair.Value.Language];
-					if (tools == null)
-						throw new UnknownLanguageException();
-
-					string path =
-						Helper.MakePathRelativeTo(project.FullPath,
-						                          Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
-					ps.WriteLine("	  <ProjectReference Include=\"{0}\">", path);
-
-					// TODO: Allow reference to visual basic projects
-					ps.WriteLine("		<Name>{0}</Name>", pair.Value.Name);
-					ps.WriteLine("		<Project>{0}</Project>", pair.Value.Guid.ToString("B").ToUpper());
-					ps.WriteLine("		<Package>{0}</Package>", tool.Guid.ToUpper());
-
-					//This is the Copy Local flag in VS
-					ps.WriteLine("		<Private>{0}</Private>", pair.Key.LocalCopy);
-
-					ps.WriteLine("	  </ProjectReference>");
-				}
-				ps.WriteLine("	</ItemGroup>");
-
-				//				  ps.WriteLine("	</Build>");
-				ps.WriteLine("	<ItemGroup>");
-
-				//				  ps.WriteLine("	  <Include>");
-				List<string> list = new List<string>();
-
-				foreach (string path in project.Files)
-				{
-					string lower = path.ToLower();
-					if (lower.EndsWith(".resx"))
-					{
-						string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
-						if (!list.Contains(codebehind))
-							list.Add(codebehind);
-					}
-
-				}
-				
-				foreach (string filePath in project.Files)
-				{
-					//					if (file == "Properties\\Bind.Designer.cs")
-					//					{
-					//						Console.WriteLine("Wait a minute!");
-					//						Console.WriteLine(project.Files.GetSubType(file).ToString());
-					//					}
-					SubType subType = project.Files.GetSubType(filePath);
-					
-					// Visual Studio chokes on file names if forward slash is used as a path separator
-					// instead of backslash.  So we must make sure that all file paths written to the
-					// project file use \ as a path separator.
-					string file = filePath.Replace(@"/", @"\");
-
-					if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
-					    && subType != SubType.CodeBehind)
-					{
-						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
-						ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
-						ps.WriteLine("		<SubType>Designer</SubType>");
-						ps.WriteLine("	  </EmbeddedResource>");
-						//
-					}
-
-					if (subType == SubType.Designer)
-					{
-						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file);
-						
-						string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
-						string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
-
-						// Check for a parent .cs file with the same name as this designer file
-						if (File.Exists(Helper.NormalizePath(dependent_name)))
-						{
-							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
-						}
-						else
-						{
-							ps.WriteLine("		<Generator>ResXFileCodeGenerator</Generator>");
-							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
-							ps.WriteLine("		<SubType>" + subType + "</SubType>");
-						}
-						
-						ps.WriteLine("	  </EmbeddedResource>");
-						if (File.Exists(Helper.NormalizePath(autogen_name)))
-						{
-							ps.WriteLine("	  <Compile Include=\"{0}\">", autogen_name);
-							//ps.WriteLine("	  <DesignTime>True</DesignTime>");
-
-							// If a parent .cs file exists, link this autogen file to it. Otherwise link
-							// to the designer file
-							if (File.Exists(dependent_name))
-							{
-								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
-							}
-							else
-							{
-								ps.WriteLine("		<AutoGen>True</AutoGen>");
-								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
-							}
-							
-							ps.WriteLine("	  </Compile>");
-						}
-						list.Add(autogen_name);
-					}
-					if (subType == SubType.Settings)
-					{
-						ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
-						ps.WriteLine("Include=\"{0}\">", file);
-						string fileName = Path.GetFileName(filePath);
-						if (project.Files.GetBuildAction(filePath) == BuildAction.None)
-						{
-							ps.WriteLine("		<Generator>SettingsSingleFileGenerator</Generator>");
-							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
-						}
-						else
-						{
-							ps.WriteLine("		<SubType>Code</SubType>");
-							ps.WriteLine("		<AutoGen>True</AutoGen>");
-							ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
-							string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
-							string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
-							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
-						}
-						ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
-					}
-					else if (subType != SubType.Designer)
-					{
-						string path = Helper.NormalizePath(file);
-						string path_lower = path.ToLower();
-
-						if (!list.Contains(filePath))
-						{
-							ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
-
-							int startPos = 0;
-							if (project.Files.GetPreservePath(filePath))
-							{
-								while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
-									startPos++;
-
-							}
-							else
-							{
-								startPos = file.LastIndexOf(Path.GetFileName(path));
-							}
-							
-							// be sure to write out the path with backslashes so VS recognizes
-							// the file properly.
-							ps.WriteLine("Include=\"{0}\">", file);
-
-							int last_period_index = file.LastIndexOf('.');
-							string short_file_name = file.Substring(0, last_period_index);
-							string extension = Path.GetExtension(path);
-							// make this upper case, so that when File.Exists tests for the
-							// existence of a designer file on a case-sensitive platform,
-							// it is correctly identified.
-							string designer_format = string.Format(".Designer{0}", extension);
-
-							if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
-							{
-								int designer_index = path.IndexOf(designer_format);
-								string file_name = path.Substring(0, designer_index);
-
-								// There are two corrections to the next lines:
-								// 1. Fix the connection between a designer file and a form
-								//	  or usercontrol that don't have an associated resx file.
-								// 2. Connect settings files to associated designer files.
-								if (File.Exists(file_name + extension))
-									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension));
-								else if (File.Exists(file_name + ".resx"))
-									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
-								else if (File.Exists(file_name + ".settings"))
-								{
-									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings"));
-									ps.WriteLine("		<AutoGen>True</AutoGen>");
-									ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
-								}
-							}
-							else if (subType == SubType.CodeBehind)
-							{
-								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
-							}
-							if (project.Files.GetIsLink(filePath))
-							{
-								string alias = project.Files.GetLinkPath(filePath);
-								alias += file.Substring(startPos);
-								alias = Helper.NormalizePath(alias);
-								ps.WriteLine("		<Link>{0}</Link>", alias);
-							}
-							else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
-							{
-								if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
-								{
-									ps.WriteLine("		<SubType>{0}</SubType>", subType);
-								}
-							}
-
-							if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
-							{
-								ps.WriteLine("		<CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath));
-							}
-
-							ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
-						}
-					}
-				}
-
-				ps.WriteLine("	</ItemGroup>");
-				ps.WriteLine("	<Import Project=\"" + toolInfo.ImportProject + "\" />");
-				ps.WriteLine("	<PropertyGroup>");
-				ps.WriteLine("	  <PreBuildEvent>");
-				ps.WriteLine("	  </PreBuildEvent>");
-				ps.WriteLine("	  <PostBuildEvent>");
-				ps.WriteLine("	  </PostBuildEvent>");
-				ps.WriteLine("	</PropertyGroup>");
-				ps.WriteLine("</Project>");
-			}
-			#endregion
-
-			#region User File
-
-			ps = new StreamWriter(projectFile + ".user");
-			using (ps)
-			{
-				// Get the first configuration from the project.
-				ConfigurationNode firstConfiguration = null;
-
-				if (project.Configurations.Count > 0)
-				{
-					firstConfiguration = project.Configurations[0];
-				}
-
-				ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
-				//ps.WriteLine( "<VisualStudioProject>" );
-				//ps.WriteLine("  <{0}>", toolInfo.XMLTag);
-				//ps.WriteLine("	<Build>");
-				ps.WriteLine("	<PropertyGroup>");
-				//ps.WriteLine("	  <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
-
-				if (firstConfiguration != null)
-				{
-					ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", firstConfiguration.Name);
-					ps.WriteLine("	  <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", firstConfiguration.Platform);
-				}
-
-				ps.WriteLine("	  <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
-				ps.WriteLine("	  <LastOpenVersion>{0}</LastOpenVersion>", ProductVersion);
-				ps.WriteLine("	  <ProjectView>ProjectFiles</ProjectView>");
-				ps.WriteLine("	  <ProjectTrust>0</ProjectTrust>");
-				ps.WriteLine("	</PropertyGroup>");
-				foreach (ConfigurationNode conf in project.Configurations)
-				{
-					ps.Write("	<PropertyGroup");
-					ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|{1}' \"", conf.Name, conf.Platform);
-					ps.WriteLine(" />");
-				}
-				ps.WriteLine("</Project>");
-			}
-			#endregion
-
-			kernel.CurrentWorkingDirectory.Pop();
-		}
-
-		private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
-		{
-			kernel.Log.Write("Creating {0} solution and project files", VersionName);
-
-			foreach (SolutionNode child in solution.Solutions)
-			{
-				kernel.Log.Write("...Creating folder: {0}", child.Name);
-				WriteSolution(child, false);
-			}
-
-			foreach (ProjectNode project in solution.Projects)
-			{
-				kernel.Log.Write("...Creating project: {0}", project.Name);
-				WriteProject(solution, project);
-			}
-
-			foreach (DatabaseProjectNode project in solution.DatabaseProjects)
-			{
-				kernel.Log.Write("...Creating database project: {0}", project.Name);
-				WriteDatabaseProject(solution, project);
-			}
-
-			if (writeSolutionToDisk) // only write main solution
-			{
-				kernel.Log.Write("");
-				string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
-				
-				using (StreamWriter ss = new StreamWriter(solutionFile))
-				{
-					kernel.CurrentWorkingDirectory.Push();
-					Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
-
-					ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
-					ss.WriteLine(SolutionTag);
-
-					WriteProjectDeclarations(ss, solution, solution);
-
-					ss.WriteLine("Global");
-
-					ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
-					foreach (ConfigurationNode conf in solution.Configurations)
-					{
-						ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
-					}
-					ss.WriteLine("\tEndGlobalSection");
-
-					ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
-					WriteConfigurationLines(solution.Configurations, solution, ss);
-					ss.WriteLine("\tEndGlobalSection");
-
-					if (solution.Solutions.Count > 0)
-					{
-						ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
-						foreach (SolutionNode embeddedSolution in solution.Solutions)
-						{
-							WriteNestedProjectMap(ss, embeddedSolution);
-						}
-						ss.WriteLine("\tEndGlobalSection");
-					}
-
-					ss.WriteLine("EndGlobal");
-				}
-
-				kernel.CurrentWorkingDirectory.Pop();
-			}
-		}
-
-		private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
-		{
-			foreach (SolutionNode childSolution in embeddedSolution.Solutions)
-			{
-				WriteEmbeddedSolution(writer, childSolution);
-				WriteProjectDeclarations(writer, actualSolution, childSolution);
-			}
-
-			foreach (ProjectNode project in embeddedSolution.Projects)
-			{
-				WriteProject(actualSolution, writer, project);
-			}
-
-			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
-			{
-				WriteProject(actualSolution, writer, dbProject);
-			}
-
-			if (actualSolution.Guid == embeddedSolution.Guid)
-			{
-				WriteSolutionFiles(actualSolution, writer);
-			}
-		}
-
-		private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
-		{
-			foreach (ProjectNode project in embeddedSolution.Projects)
-			{
-				WriteNestedProject(writer, embeddedSolution, project.Guid);
-			}
-
-			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
-			{
-				WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
-			}
-
-			foreach (SolutionNode child in embeddedSolution.Solutions)
-			{
-				WriteNestedProject(writer, embeddedSolution, child.Guid);
-				WriteNestedProjectMap(writer, child);
-			}
-		}
-
-		private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
-		{
-			WriteNestedFolder(writer, solution.Guid, projectGuid);
-		}
-
-		private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
-		{
-			writer.WriteLine("\t\t{0} = {1}",
-			                 childGuid.ToString("B").ToUpper(),
-			                 parentGuid.ToString("B").ToUpper());
-		}
-
-		private static void WriteConfigurationLines(IEnumerable<ConfigurationNode> configurations, SolutionNode solution, TextWriter ss)
-		{
-			foreach (ProjectNode project in solution.Projects)
-			{
-				foreach (ConfigurationNode conf in configurations)
-				{
-					ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
-					             project.Guid.ToString("B").ToUpper(),
-					             conf.NameAndPlatform);
-
-					ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
-					             project.Guid.ToString("B").ToUpper(),
-					             conf.NameAndPlatform);
-				}
-			}
-
-			foreach (SolutionNode child in solution.Solutions)
-			{
-				WriteConfigurationLines(configurations, child, ss);
-			}
-		}
-
-		private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
-		{
-			if(solution.Files != null && solution.Files.Count > 0)
-				WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
-		}
-
-		private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
-		{
-			WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
-		}
-
-		private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
-		{
-			WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
-		}
-
-		private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
-		{
-			if (solution.Files != null && solution.Files.Count > 0)
-				WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
-		}
-
-		const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
-		const string ProjectDeclarationEndFormat = "EndProject";
-
-		private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
-		{
-			if (!tools.ContainsKey(language))
-				throw new UnknownLanguageException("Unknown .NET language: " + language);
-
-			ToolInfo toolInfo = tools[language];
-
-			string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
-
-			path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
-
-			WriteProject(ss, language, guid, name, path);
-		}
-
-		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
-		{
-			WriteProject(writer, language, projectGuid, name, location, null);
-		}
-
-		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
-		{
-			if (!tools.ContainsKey(language))
-				throw new UnknownLanguageException("Unknown .NET language: " + language);
-
-			ToolInfo toolInfo = tools[language];
-
-			writer.WriteLine(ProjectDeclarationBeginFormat,
-			                 toolInfo.Guid,
-			                 name,
-			                 location,
-			                 projectGuid.ToString("B").ToUpper());
-
-			if (files != null)
-			{
-				writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
-
-				foreach (string file in files)
-					writer.WriteLine("\t\t{0} = {0}", file);
-
-				writer.WriteLine("\tEndProjectSection");
-			}
-
-			writer.WriteLine(ProjectDeclarationEndFormat);
-		}
-
-		private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
-		{
-			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
-			IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), "	  ");
-
-			kernel.CurrentWorkingDirectory.Push();
-
-			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
-
-			using (ps)
-			{
-				ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
-				ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
-				ps.Indent++;
-				ps.WriteLine("MSDTVersion = \"80\"");
-				// TODO: Use the project.Files property
-				if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
-					WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
-
-				ps.WriteLine("Begin DBRefFolder = \"Database References\"");
-				ps.Indent++;
-				foreach (DatabaseReferenceNode reference in project.References)
-				{
-					ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
-					ps.Indent++;
-					ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
-					ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
-					//ps.WriteLine("Colorizer = 5");
-					ps.Indent--;
-					ps.WriteLine("End");
-				}
-				ps.Indent--;
-				ps.WriteLine("End");
-				ps.Indent--;
-				ps.WriteLine("End");
-
-				ps.Flush();
-			}
-
-			kernel.CurrentWorkingDirectory.Pop();
-		}
-
-		private static bool ContainsSqlFiles(string folder)
-		{
-			if(Directory.GetFiles(folder, "*.sql").Length > 0)
-				return true; // if the folder contains 1 .sql file, that's good enough
-
-			foreach (string child in Directory.GetDirectories(folder))
-			{
-				if (ContainsSqlFiles(child))
-					return true; // if 1 child folder contains a .sql file, still good enough
-			}
-
-			return false;
-		}
-
-		private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
-		{
-			foreach (string child in Directory.GetDirectories(folder))
-			{
-				if (ContainsSqlFiles(child))
-				{
-					writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
-					writer.Indent++;
-					WriteDatabaseFoldersAndFiles(writer, child);
-					writer.Indent--;
-					writer.WriteLine("End");
-				}
-			}
-			foreach (string file in Directory.GetFiles(folder, "*.sql"))
-			{
-				writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
-			}
-		}
-
-		private void CleanProject(ProjectNode project)
-		{
-			kernel.Log.Write("...Cleaning project: {0}", project.Name);
-
-			ToolInfo toolInfo = tools[project.Language];
-			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
-			string userFile = projectFile + ".user";
-
-			Helper.DeleteIfExists(projectFile);
-			Helper.DeleteIfExists(userFile);
-		}
-
-		private void CleanSolution(SolutionNode solution)
-		{
-			kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
-
-			string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
-			string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
-
-			Helper.DeleteIfExists(slnFile);
-			Helper.DeleteIfExists(suoFile);
-
-			foreach (ProjectNode project in solution.Projects)
-			{
-				CleanProject(project);
-			}
-
-			kernel.Log.Write("");
-		}
-
-		#endregion
-
-		#region ITarget Members
-
-		/// <summary>
-		/// Writes the specified kern.
-		/// </summary>
-		/// <param name="kern">The kern.</param>
-		public virtual void Write(Kernel kern)
-		{
-			if (kern == null)
-			{
-				throw new ArgumentNullException("kern");
-			}
-			kernel = kern;
-			foreach (SolutionNode sol in kernel.Solutions)
-			{
-				WriteSolution(sol, true);
-			}
-			kernel = null;
-		}
-
-		/// <summary>
-		/// Cleans the specified kern.
-		/// </summary>
-		/// <param name="kern">The kern.</param>
-		public virtual void Clean(Kernel kern)
-		{
-			if (kern == null)
-			{
-				throw new ArgumentNullException("kern");
-			}
-			kernel = kern;
-			foreach (SolutionNode sol in kernel.Solutions)
-			{
-				CleanSolution(sol);
-			}
-			kernel = null;
-		}
-
-		#endregion
-	}
-}
+#region BSD License
+/*
+Copyright (c) 2008 Matthew Holmes ([email protected]), John Anderson ([email protected])
+
+Redistribution and use in source and binary forms, with or without modification, are permitted
+provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions
+  and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
+  and the following disclaimer in the documentation and/or other materials provided with the
+  distribution.
+ * The name of the author may not be used to endorse or promote products derived from this software
+  without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Prebuild.Core.Interfaces;
+using Prebuild.Core.Nodes;
+using Prebuild.Core.Utilities;
+using System.CodeDom.Compiler;
+
+namespace Prebuild.Core.Targets
+{
+
+	/// <summary>
+	/// 
+	/// </summary>
+	public abstract class VSGenericTarget : ITarget
+	{
+		#region Fields
+
+		readonly Dictionary<string, ToolInfo> tools = new Dictionary<string, ToolInfo>();
+		Kernel kernel;
+		#endregion
+
+		#region Properties
+		/// <summary>
+		/// Gets or sets the solution version.
+		/// </summary>
+		/// <value>The solution version.</value>
+		public abstract string SolutionVersion { get; }
+		/// <summary>
+		/// Gets or sets the product version.
+		/// </summary>
+		/// <value>The product version.</value>
+		public abstract string ProductVersion { get; }
+		/// <summary>
+		/// Gets or sets the schema version.
+		/// </summary>
+		/// <value>The schema version.</value>
+		public abstract string SchemaVersion { get; }
+		/// <summary>
+		/// Gets or sets the name of the version.
+		/// </summary>
+		/// <value>The name of the version.</value>
+		public abstract string VersionName { get; }
+		/// <summary>
+		/// Gets or sets the version.
+		/// </summary>
+		/// <value>The version.</value>
+		public abstract VSVersion Version { get; }
+		/// <summary>
+		/// Gets the name.
+		/// </summary>
+		/// <value>The name.</value>
+		public abstract string Name { get; }
+
+		protected abstract string GetToolsVersionXml(FrameworkVersion version);
+		public abstract string SolutionTag { get; }
+
+		#endregion
+
+		#region Constructors
+
+		/// <summary>
+		/// Initializes a new instance of the <see cref="VSGenericTarget"/> class.
+		/// </summary>
+		protected VSGenericTarget()
+		{
+			tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets");
+			tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN");
+			tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets");
+			tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets");
+			tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null);
+		}
+
+		#endregion
+
+		#region Private Methods
+
+		private string MakeRefPath(ProjectNode project)
+		{
+			string ret = "";
+			foreach (ReferencePathNode node in project.ReferencePaths)
+			{
+				try
+				{
+					string fullPath = Helper.ResolvePath(node.Path);
+					if (ret.Length < 1)
+					{
+						ret = fullPath;
+					}
+					else
+					{
+						ret += ";" + fullPath;
+					}
+				}
+				catch (ArgumentException)
+				{
+					kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path);
+				}
+			}
+
+			return ret;
+		}
+
+		private static ProjectNode FindProjectInSolution(string name, SolutionNode solution)
+		{
+			SolutionNode node = solution;
+
+			while (node.Parent is SolutionNode)
+				node = node.Parent as SolutionNode;
+
+			return FindProjectInSolutionRecursively(name, node);
+		}
+
+		private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution)
+		{
+			if (solution.ProjectsTable.ContainsKey(name))
+				return solution.ProjectsTable[name];
+
+			foreach (SolutionNode child in solution.Solutions)
+			{
+				ProjectNode node = FindProjectInSolutionRecursively(name, child);
+				if (node != null)
+					return node;
+			}
+
+			return null;
+		}
+
+		private void WriteProject(SolutionNode solution, ProjectNode project)
+		{
+			if (!tools.ContainsKey(project.Language))
+			{
+				throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
+			}
+
+			ToolInfo toolInfo = tools[project.Language];
+			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+			StreamWriter ps = new StreamWriter(projectFile);
+
+			kernel.CurrentWorkingDirectory.Push();
+			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+			#region Project File
+			using (ps)
+			{
+				ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {0}>", GetToolsVersionXml(project.FrameworkVersion));
+				ps.WriteLine("	<PropertyGroup>");
+				ps.WriteLine("	  <ProjectType>Local</ProjectType>");
+				ps.WriteLine("	  <ProductVersion>{0}</ProductVersion>", ProductVersion);
+				ps.WriteLine("	  <SchemaVersion>{0}</SchemaVersion>", SchemaVersion);
+				ps.WriteLine("	  <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
+
+				// Visual Studio has a hard coded guid for the project type
+				if (project.Type == ProjectType.Web)
+					ps.WriteLine("	  <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
+				ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
+				ps.WriteLine("	  <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
+				ps.WriteLine("	  <AssemblyKeyContainerName>");
+				ps.WriteLine("	  </AssemblyKeyContainerName>");
+				ps.WriteLine("	  <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
+				foreach (ConfigurationNode conf in project.Configurations)
+				{
+					if (conf.Options.KeyFile != "")
+					{
+						ps.WriteLine("	  <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
+						ps.WriteLine("	  <SignAssembly>true</SignAssembly>");
+						break;
+					}
+				}
+				ps.WriteLine("	  <DefaultClientScript>JScript</DefaultClientScript>");
+				ps.WriteLine("	  <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
+				ps.WriteLine("	  <DefaultTargetSchema>IE50</DefaultTargetSchema>");
+				ps.WriteLine("	  <DelaySign>false</DelaySign>");
+				ps.WriteLine("	  <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
+
+				ps.WriteLine("	  <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
+				ps.WriteLine("	  <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
+				ps.WriteLine("	  <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
+				ps.WriteLine("	  <StartupObject>{0}</StartupObject>", project.StartupObject);
+				if (string.IsNullOrEmpty(project.DebugStartParameters))
+				{
+					ps.WriteLine("	  <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
+				}
+				ps.WriteLine("	  <FileUpgradeFlags>");
+				ps.WriteLine("	  </FileUpgradeFlags>");
+
+				ps.WriteLine("	</PropertyGroup>");
+
+				foreach (ConfigurationNode conf in project.Configurations)
+				{
+					ps.Write("	<PropertyGroup ");
+					ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
+					ps.WriteLine("	  <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
+					ps.WriteLine("	  <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
+					ps.WriteLine("	  <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
+					ps.WriteLine("	  <ConfigurationOverrideFile>");
+					ps.WriteLine("	  </ConfigurationOverrideFile>");
+					ps.WriteLine("	  <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
+					ps.WriteLine("	  <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
+					ps.WriteLine("	  <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
+					ps.WriteLine("	  <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
+					ps.WriteLine("	  <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
+					if (project.Type != ProjectType.Web)
+						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
+						             Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
+					else
+						ps.WriteLine("	  <OutputPath>{0}</OutputPath>",
+						             Helper.EndPath(Helper.NormalizePath("bin\\")));
+
+					ps.WriteLine("	  <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
+					ps.WriteLine("	  <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
+					ps.WriteLine("	  <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
+					ps.WriteLine("	  <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
+					ps.WriteLine("	  <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
+					ps.WriteLine("	  <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
+					ps.WriteLine("	  <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
+					ps.WriteLine("	</PropertyGroup>");
+				}
+
+				//ps.WriteLine("	  </Settings>");
+
+				Dictionary<ReferenceNode, ProjectNode> projectReferences = new Dictionary<ReferenceNode, ProjectNode>();
+				List<ReferenceNode> otherReferences = new List<ReferenceNode>();
+
+				foreach (ReferenceNode refr in project.References)
+				{
+					ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
+
+					if (projectNode == null)
+						otherReferences.Add(refr);
+					else
+						projectReferences.Add(refr, projectNode);
+				}
+				// Assembly References
+				ps.WriteLine("	<ItemGroup>");
+
+				foreach (ReferenceNode refr in otherReferences)
+				{
+					ps.Write("	  <Reference");
+					ps.Write(" Include=\"");
+					ps.Write(refr.Name);
+					ps.WriteLine("\" >");
+					ps.Write("		  <Name>");
+					ps.Write(refr.Name);
+					ps.WriteLine("</Name>");
+										
+					if(!String.IsNullOrEmpty(refr.Path))
+					{
+						// Use absolute path to assembly (for determining assembly type)
+						string absolutePath = Path.Combine(project.FullPath, refr.Path);
+						if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "exe"))) {
+							// Assembly is an executable (exe)
+							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "exe"));
+						} else if(File.Exists(Helper.MakeFilePath(absolutePath, refr.Name, "dll"))) {
+							// Assembly is an library (dll)							
+							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+						} else {
+							string referencePath = Helper.MakeFilePath(refr.Path, refr.Name, "dll");
+							kernel.Log.Write(LogType.Warning, "Reference \"{0}\": The specified file doesn't exist.", referencePath);
+							ps.WriteLine("		<HintPath>{0}</HintPath>", Helper.MakeFilePath(refr.Path, refr.Name, "dll"));
+						}
+					}
+					
+					ps.WriteLine("		<Private>{0}</Private>", refr.LocalCopy);
+					ps.WriteLine("	  </Reference>");
+				}
+				ps.WriteLine("	</ItemGroup>");
+
+				//Project References
+				ps.WriteLine("	<ItemGroup>");
+				foreach (KeyValuePair<ReferenceNode, ProjectNode> pair in projectReferences)
+				{
+					ToolInfo tool = tools[pair.Value.Language];
+					if (tools == null)
+						throw new UnknownLanguageException();
+
+					string path =
+						Helper.MakePathRelativeTo(project.FullPath,
+						                          Helper.MakeFilePath(pair.Value.FullPath, pair.Value.Name, tool.FileExtension));
+					ps.WriteLine("	  <ProjectReference Include=\"{0}\">", path);
+
+					// TODO: Allow reference to visual basic projects
+					ps.WriteLine("		<Name>{0}</Name>", pair.Value.Name);
+					ps.WriteLine("		<Project>{0}</Project>", pair.Value.Guid.ToString("B").ToUpper());
+					ps.WriteLine("		<Package>{0}</Package>", tool.Guid.ToUpper());
+
+					//This is the Copy Local flag in VS
+					ps.WriteLine("		<Private>{0}</Private>", pair.Key.LocalCopy);
+
+					ps.WriteLine("	  </ProjectReference>");
+				}
+				ps.WriteLine("	</ItemGroup>");
+
+				//				  ps.WriteLine("	</Build>");
+				ps.WriteLine("	<ItemGroup>");
+
+				//				  ps.WriteLine("	  <Include>");
+				List<string> list = new List<string>();
+
+				foreach (string path in project.Files)
+				{
+					string lower = path.ToLower();
+					if (lower.EndsWith(".resx"))
+					{
+						string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension);
+						if (!list.Contains(codebehind))
+							list.Add(codebehind);
+					}
+
+				}
+				
+				foreach (string filePath in project.Files)
+				{
+					//					if (file == "Properties\\Bind.Designer.cs")
+					//					{
+					//						Console.WriteLine("Wait a minute!");
+					//						Console.WriteLine(project.Files.GetSubType(file).ToString());
+					//					}
+					SubType subType = project.Files.GetSubType(filePath);
+					
+					// Visual Studio chokes on file names if forward slash is used as a path separator
+					// instead of backslash.  So we must make sure that all file paths written to the
+					// project file use \ as a path separator.
+					string file = filePath.Replace(@"/", @"\");
+
+					if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer
+					    && subType != SubType.CodeBehind)
+					{
+						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file.Substring(0, file.LastIndexOf('.')) + ".resx");
+						ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file));
+						ps.WriteLine("		<SubType>Designer</SubType>");
+						ps.WriteLine("	  </EmbeddedResource>");
+						//
+					}
+
+					if (subType == SubType.Designer)
+					{
+						ps.WriteLine("	  <EmbeddedResource Include=\"{0}\">", file);
+						
+						string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs";
+						string dependent_name = filePath.Substring(0, file.LastIndexOf('.')) + ".cs";
+
+						// Check for a parent .cs file with the same name as this designer file
+						if (File.Exists(Helper.NormalizePath(dependent_name)))
+						{
+							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
+						}
+						else
+						{
+							ps.WriteLine("		<Generator>ResXFileCodeGenerator</Generator>");
+							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", Path.GetFileName(autogen_name));
+							ps.WriteLine("		<SubType>" + subType + "</SubType>");
+						}
+						
+						ps.WriteLine("	  </EmbeddedResource>");
+						if (File.Exists(Helper.NormalizePath(autogen_name)))
+						{
+							ps.WriteLine("	  <Compile Include=\"{0}\">", autogen_name);
+							//ps.WriteLine("	  <DesignTime>True</DesignTime>");
+
+							// If a parent .cs file exists, link this autogen file to it. Otherwise link
+							// to the designer file
+							if (File.Exists(dependent_name))
+							{
+								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(dependent_name));
+							}
+							else
+							{
+								ps.WriteLine("		<AutoGen>True</AutoGen>");
+								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(filePath));
+							}
+							
+							ps.WriteLine("	  </Compile>");
+						}
+						list.Add(autogen_name);
+					}
+					if (subType == SubType.Settings)
+					{
+						ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
+						ps.WriteLine("Include=\"{0}\">", file);
+						string fileName = Path.GetFileName(filePath);
+						if (project.Files.GetBuildAction(filePath) == BuildAction.None)
+						{
+							ps.WriteLine("		<Generator>SettingsSingleFileGenerator</Generator>");
+							ps.WriteLine("		<LastGenOutput>{0}</LastGenOutput>", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs");
+						}
+						else
+						{
+							ps.WriteLine("		<SubType>Code</SubType>");
+							ps.WriteLine("		<AutoGen>True</AutoGen>");
+							ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
+							string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.'));
+							string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.'));
+							ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(fileNameShorter + ".settings"));
+						}
+						ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
+					}
+					else if (subType != SubType.Designer)
+					{
+						string path = Helper.NormalizePath(file);
+						string path_lower = path.ToLower();
+
+						if (!list.Contains(filePath))
+						{
+							ps.Write("	  <{0} ", project.Files.GetBuildAction(filePath));
+
+							int startPos = 0;
+							if (project.Files.GetPreservePath(filePath))
+							{
+								while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1)
+									startPos++;
+
+							}
+							else
+							{
+								startPos = file.LastIndexOf(Path.GetFileName(path));
+							}
+							
+							// be sure to write out the path with backslashes so VS recognizes
+							// the file properly.
+							ps.WriteLine("Include=\"{0}\">", file);
+
+							int last_period_index = file.LastIndexOf('.');
+							string short_file_name = file.Substring(0, last_period_index);
+							string extension = Path.GetExtension(path);
+							// make this upper case, so that when File.Exists tests for the
+							// existence of a designer file on a case-sensitive platform,
+							// it is correctly identified.
+							string designer_format = string.Format(".Designer{0}", extension);
+
+							if (path_lower.EndsWith(designer_format.ToLowerInvariant()))
+							{
+								int designer_index = path.IndexOf(designer_format);
+								string file_name = path.Substring(0, designer_index);
+
+								// There are two corrections to the next lines:
+								// 1. Fix the connection between a designer file and a form
+								//	  or usercontrol that don't have an associated resx file.
+								// 2. Connect settings files to associated designer files.
+								if (File.Exists(file_name + extension))
+									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + extension));
+								else if (File.Exists(file_name + ".resx"))
+									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".resx"));
+								else if (File.Exists(file_name + ".settings"))
+								{
+									ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(file_name + ".settings"));
+									ps.WriteLine("		<AutoGen>True</AutoGen>");
+									ps.WriteLine("		<DesignTimeSharedInput>True</DesignTimeSharedInput>");
+								}
+							}
+							else if (subType == SubType.CodeBehind)
+							{
+								ps.WriteLine("		<DependentUpon>{0}</DependentUpon>", Path.GetFileName(short_file_name));
+							}
+							if (project.Files.GetIsLink(filePath))
+							{
+								string alias = project.Files.GetLinkPath(filePath);
+								alias += file.Substring(startPos);
+								alias = Helper.NormalizePath(alias);
+								ps.WriteLine("		<Link>{0}</Link>", alias);
+							}
+							else if (project.Files.GetBuildAction(filePath) != BuildAction.None)
+							{
+								if (project.Files.GetBuildAction(filePath) != BuildAction.EmbeddedResource)
+								{
+									ps.WriteLine("		<SubType>{0}</SubType>", subType);
+								}
+							}
+
+							if (project.Files.GetCopyToOutput(filePath) != CopyToOutput.Never)
+							{
+								ps.WriteLine("		<CopyToOutputDirectory>{0}</CopyToOutputDirectory>", project.Files.GetCopyToOutput(filePath));
+							}
+
+							ps.WriteLine("	  </{0}>", project.Files.GetBuildAction(filePath));
+						}
+					}
+				}
+
+				ps.WriteLine("	</ItemGroup>");
+				ps.WriteLine("	<Import Project=\"" + toolInfo.ImportProject + "\" />");
+				ps.WriteLine("	<PropertyGroup>");
+				ps.WriteLine("	  <PreBuildEvent>");
+				ps.WriteLine("	  </PreBuildEvent>");
+				ps.WriteLine("	  <PostBuildEvent>");
+				ps.WriteLine("	  </PostBuildEvent>");
+				ps.WriteLine("	</PropertyGroup>");
+				ps.WriteLine("</Project>");
+			}
+			#endregion
+
+			#region User File
+
+			ps = new StreamWriter(projectFile + ".user");
+			using (ps)
+			{
+				// Get the first configuration from the project.
+				ConfigurationNode firstConfiguration = null;
+
+				if (project.Configurations.Count > 0)
+				{
+					firstConfiguration = project.Configurations[0];
+				}
+
+				ps.WriteLine("<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
+				//ps.WriteLine( "<VisualStudioProject>" );
+				//ps.WriteLine("  <{0}>", toolInfo.XMLTag);
+				//ps.WriteLine("	<Build>");
+				ps.WriteLine("	<PropertyGroup>");
+				//ps.WriteLine("	  <Settings ReferencePath=\"{0}\">", MakeRefPath(project));
+
+				if (firstConfiguration != null)
+				{
+					ps.WriteLine("	  <Configuration Condition=\" '$(Configuration)' == '' \">{0}</Configuration>", firstConfiguration.Name);
+					ps.WriteLine("	  <Platform Condition=\" '$(Platform)' == '' \">{0}</Platform>", firstConfiguration.Platform);
+				}
+
+				ps.WriteLine("	  <ReferencePath>{0}</ReferencePath>", MakeRefPath(project));
+				ps.WriteLine("	  <LastOpenVersion>{0}</LastOpenVersion>", ProductVersion);
+				ps.WriteLine("	  <ProjectView>ProjectFiles</ProjectView>");
+				ps.WriteLine("	  <ProjectTrust>0</ProjectTrust>");
+				ps.WriteLine("	</PropertyGroup>");
+				foreach (ConfigurationNode conf in project.Configurations)
+				{
+					ps.Write("	<PropertyGroup");
+					ps.Write(" Condition = \" '$(Configuration)|$(Platform)' == '{0}|{1}' \"", conf.Name, conf.Platform);
+					ps.WriteLine(" />");
+				}
+				ps.WriteLine("</Project>");
+			}
+			#endregion
+
+			kernel.CurrentWorkingDirectory.Pop();
+		}
+
+		private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk)
+		{
+			kernel.Log.Write("Creating {0} solution and project files", VersionName);
+
+			foreach (SolutionNode child in solution.Solutions)
+			{
+				kernel.Log.Write("...Creating folder: {0}", child.Name);
+				WriteSolution(child, false);
+			}
+
+			foreach (ProjectNode project in solution.Projects)
+			{
+				kernel.Log.Write("...Creating project: {0}", project.Name);
+				WriteProject(solution, project);
+			}
+
+			foreach (DatabaseProjectNode project in solution.DatabaseProjects)
+			{
+				kernel.Log.Write("...Creating database project: {0}", project.Name);
+				WriteDatabaseProject(solution, project);
+			}
+
+			if (writeSolutionToDisk) // only write main solution
+			{
+				kernel.Log.Write("");
+				string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+				
+				using (StreamWriter ss = new StreamWriter(solutionFile))
+				{
+					kernel.CurrentWorkingDirectory.Push();
+					Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile));
+
+					ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", SolutionVersion);
+					ss.WriteLine(SolutionTag);
+
+					WriteProjectDeclarations(ss, solution, solution);
+
+					ss.WriteLine("Global");
+
+					ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution");
+					foreach (ConfigurationNode conf in solution.Configurations)
+					{
+						ss.WriteLine("\t\t{0} = {0}", conf.NameAndPlatform);
+					}
+					ss.WriteLine("\tEndGlobalSection");
+
+					ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution");
+					WriteConfigurationLines(solution.Configurations, solution, ss);
+					ss.WriteLine("\tEndGlobalSection");
+
+					if (solution.Solutions.Count > 0)
+					{
+						ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution");
+						foreach (SolutionNode embeddedSolution in solution.Solutions)
+						{
+							WriteNestedProjectMap(ss, embeddedSolution);
+						}
+						ss.WriteLine("\tEndGlobalSection");
+					}
+
+					ss.WriteLine("EndGlobal");
+				}
+
+				kernel.CurrentWorkingDirectory.Pop();
+			}
+		}
+
+		private void WriteProjectDeclarations(TextWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution)
+		{
+			foreach (SolutionNode childSolution in embeddedSolution.Solutions)
+			{
+				WriteEmbeddedSolution(writer, childSolution);
+				WriteProjectDeclarations(writer, actualSolution, childSolution);
+			}
+
+			foreach (ProjectNode project in embeddedSolution.Projects)
+			{
+				WriteProject(actualSolution, writer, project);
+			}
+
+			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
+			{
+				WriteProject(actualSolution, writer, dbProject);
+			}
+
+			if (actualSolution.Guid == embeddedSolution.Guid)
+			{
+				WriteSolutionFiles(actualSolution, writer);
+			}
+		}
+
+		private static void WriteNestedProjectMap(TextWriter writer, SolutionNode embeddedSolution)
+		{
+			foreach (ProjectNode project in embeddedSolution.Projects)
+			{
+				WriteNestedProject(writer, embeddedSolution, project.Guid);
+			}
+
+			foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects)
+			{
+				WriteNestedProject(writer, embeddedSolution, dbProject.Guid);
+			}
+
+			foreach (SolutionNode child in embeddedSolution.Solutions)
+			{
+				WriteNestedProject(writer, embeddedSolution, child.Guid);
+				WriteNestedProjectMap(writer, child);
+			}
+		}
+
+		private static void WriteNestedProject(TextWriter writer, SolutionNode solution, Guid projectGuid)
+		{
+			WriteNestedFolder(writer, solution.Guid, projectGuid);
+		}
+
+		private static void WriteNestedFolder(TextWriter writer, Guid parentGuid, Guid childGuid)
+		{
+			writer.WriteLine("\t\t{0} = {1}",
+			                 childGuid.ToString("B").ToUpper(),
+			                 parentGuid.ToString("B").ToUpper());
+		}
+
+		private static void WriteConfigurationLines(IEnumerable<ConfigurationNode> configurations, SolutionNode solution, TextWriter ss)
+		{
+			foreach (ProjectNode project in solution.Projects)
+			{
+				foreach (ConfigurationNode conf in configurations)
+				{
+					ss.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}",
+					             project.Guid.ToString("B").ToUpper(),
+					             conf.NameAndPlatform);
+
+					ss.WriteLine("\t\t{0}.{1}.Build.0 = {1}",
+					             project.Guid.ToString("B").ToUpper(),
+					             conf.NameAndPlatform);
+				}
+			}
+
+			foreach (SolutionNode child in solution.Solutions)
+			{
+				WriteConfigurationLines(configurations, child, ss);
+			}
+		}
+
+		private void WriteSolutionFiles(SolutionNode solution, TextWriter ss)
+		{
+			if(solution.Files != null && solution.Files.Count > 0)
+				WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files);
+		}
+
+		private void WriteEmbeddedSolution(TextWriter writer, SolutionNode embeddedSolution)
+		{
+			WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files);
+		}
+
+		private void WriteProject(SolutionNode solution, TextWriter ss, ProjectNode project)
+		{
+			WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath);
+		}
+
+		private void WriteProject(SolutionNode solution, TextWriter ss, DatabaseProjectNode dbProject)
+		{
+			if (solution.Files != null && solution.Files.Count > 0)
+				WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath);
+		}
+
+		const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\"";
+		const string ProjectDeclarationEndFormat = "EndProject";
+
+		private void WriteProject(TextWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath)
+		{
+			if (!tools.ContainsKey(language))
+				throw new UnknownLanguageException("Unknown .NET language: " + language);
+
+			ToolInfo toolInfo = tools[language];
+
+			string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath);
+
+			path = Helper.MakeFilePath(path, name, toolInfo.FileExtension);
+
+			WriteProject(ss, language, guid, name, path);
+		}
+
+		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location)
+		{
+			WriteProject(writer, language, projectGuid, name, location, null);
+		}
+
+		private void WriteProject(TextWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files)
+		{
+			if (!tools.ContainsKey(language))
+				throw new UnknownLanguageException("Unknown .NET language: " + language);
+
+			ToolInfo toolInfo = tools[language];
+
+			writer.WriteLine(ProjectDeclarationBeginFormat,
+			                 toolInfo.Guid,
+			                 name,
+			                 location,
+			                 projectGuid.ToString("B").ToUpper());
+
+			if (files != null)
+			{
+				writer.WriteLine("\tProjectSection(SolutionItems) = preProject");
+
+				foreach (string file in files)
+					writer.WriteLine("\t\t{0} = {0}", file);
+
+				writer.WriteLine("\tEndProjectSection");
+			}
+
+			writer.WriteLine(ProjectDeclarationEndFormat);
+		}
+
+		private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project)
+		{
+			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp");
+			IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), "	  ");
+
+			kernel.CurrentWorkingDirectory.Push();
+
+			Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
+
+			using (ps)
+			{
+				ps.WriteLine("# Microsoft Developer Studio Project File - Database Project");
+				ps.WriteLine("Begin DataProject = \"{0}\"", project.Name);
+				ps.Indent++;
+				ps.WriteLine("MSDTVersion = \"80\"");
+				// TODO: Use the project.Files property
+				if (ContainsSqlFiles(Path.GetDirectoryName(projectFile)))
+					WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile));
+
+				ps.WriteLine("Begin DBRefFolder = \"Database References\"");
+				ps.Indent++;
+				foreach (DatabaseReferenceNode reference in project.References)
+				{
+					ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name);
+					ps.Indent++;
+					ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString);
+					ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper());
+					//ps.WriteLine("Colorizer = 5");
+					ps.Indent--;
+					ps.WriteLine("End");
+				}
+				ps.Indent--;
+				ps.WriteLine("End");
+				ps.Indent--;
+				ps.WriteLine("End");
+
+				ps.Flush();
+			}
+
+			kernel.CurrentWorkingDirectory.Pop();
+		}
+
+		private static bool ContainsSqlFiles(string folder)
+		{
+			if(Directory.GetFiles(folder, "*.sql").Length > 0)
+				return true; // if the folder contains 1 .sql file, that's good enough
+
+			foreach (string child in Directory.GetDirectories(folder))
+			{
+				if (ContainsSqlFiles(child))
+					return true; // if 1 child folder contains a .sql file, still good enough
+			}
+
+			return false;
+		}
+
+		private static void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder)
+		{
+			foreach (string child in Directory.GetDirectories(folder))
+			{
+				if (ContainsSqlFiles(child))
+				{
+					writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child));
+					writer.Indent++;
+					WriteDatabaseFoldersAndFiles(writer, child);
+					writer.Indent--;
+					writer.WriteLine("End");
+				}
+			}
+			foreach (string file in Directory.GetFiles(folder, "*.sql"))
+			{
+				writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file));
+			}
+		}
+
+		private void CleanProject(ProjectNode project)
+		{
+			kernel.Log.Write("...Cleaning project: {0}", project.Name);
+
+			ToolInfo toolInfo = tools[project.Language];
+			string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
+			string userFile = projectFile + ".user";
+
+			Helper.DeleteIfExists(projectFile);
+			Helper.DeleteIfExists(userFile);
+		}
+
+		private void CleanSolution(SolutionNode solution)
+		{
+			kernel.Log.Write("Cleaning {0} solution and project files", VersionName, solution.Name);
+
+			string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln");
+			string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo");
+
+			Helper.DeleteIfExists(slnFile);
+			Helper.DeleteIfExists(suoFile);
+
+			foreach (ProjectNode project in solution.Projects)
+			{
+				CleanProject(project);
+			}
+
+			kernel.Log.Write("");
+		}
+
+		#endregion
+
+		#region ITarget Members
+
+		/// <summary>
+		/// Writes the specified kern.
+		/// </summary>
+		/// <param name="kern">The kern.</param>
+		public virtual void Write(Kernel kern)
+		{
+			if (kern == null)
+			{
+				throw new ArgumentNullException("kern");
+			}
+			kernel = kern;
+			foreach (SolutionNode sol in kernel.Solutions)
+			{
+				WriteSolution(sol, true);
+			}
+			kernel = null;
+		}
+
+		/// <summary>
+		/// Cleans the specified kern.
+		/// </summary>
+		/// <param name="kern">The kern.</param>
+		public virtual void Clean(Kernel kern)
+		{
+			if (kern == null)
+			{
+				throw new ArgumentNullException("kern");
+			}
+			kernel = kern;
+			foreach (SolutionNode sol in kernel.Solutions)
+			{
+				CleanSolution(sol);
+			}
+			kernel = null;
+		}
+
+		#endregion
+	}
+}