Hi,

I suggest to override OutputPath in .csproj in build-file. It could be useful to write 
some easy to maintain build files as that:

    <target name="build">

            <solution configuration="Release" output="${build.dir}">
                    <projects>
                         <includes name="**/*.csproj"/>
                    </projects>
            </solution>
        
    </target>

and need not to care what pathes are in .csprojs.

Patch to this is attached [not sure about coding conventions]
There are some minor bug-fixes related to path problems as well.

Martin

btw: maybe this could/should be done as general argument passing to csc? Enable to 
override any argument? Is that alCSCArguments parameter meant to be this?


----------> Created by Email.cz  http://www.email.cz <---------- Get Your Free Email  



----------> Created by Email.cz  http://www.email.cz <---------- Get Your Free Email  

--- E:\src\nant\distrib\NAnt.VSNet\Tasks\SolutionTask.cs        Fri Jul 25 10:07:28 
2003
+++ E:\src\nant\src\NAnt.VSNet\Tasks\SolutionTask.cs    Tue Aug 19 16:59:06 2003
@@ -20,6 +20,7 @@
 using System.ComponentModel;
 using System.Collections;
 using System.Diagnostics;
+using System.IO;
 
 using NAnt.Core;
 using NAnt.Core.Attributes;
@@ -174,7 +175,13 @@
             set { _strConfiguration = value; }
         }
 
-        string _strSolutionFile, _strConfiguration;
+        [TaskAttribute("output")]
+        public string OutputPath {
+           get { return _outPath;}
+            set { _outPath = Project.GetFullPath(value); }
+        }
+       
+        string _strSolutionFile, _strConfiguration, _outPath;
         FileSet _fsProjects, _fsReferenceProjects;
     }
 }
--- E:\src\nant\distrib\NAnt.VSNet\ConfigurationSettings.cs     Sun May 25 20:20:26 
2003
+++ E:\src\nant\src\NAnt.VSNet\ConfigurationSettings.cs Tue Aug 19 16:53:56 2003
@@ -27,10 +27,15 @@
     /// Summary description for ConfigurationSettings.
     /// </summary>
     public class ConfigurationSettings {
-        public ConfigurationSettings( ProjectSettings ps, XmlElement elemConfig ) {
-            _alSettings = new ArrayList();
+        public ConfigurationSettings( ProjectSettings ps, XmlElement elemConfig, 
string outputOverride) {
+            _alSettings = new ArrayList();         
             _strRelOutputPath = elemConfig.Attributes[ "OutputPath" ].Value;
-            _strOutputPath = new DirectoryInfo( ps.ProjectRootDirectory + @"\" + 
elemConfig.Attributes[ "OutputPath" ].Value ).FullName;
+
+           if(outputOverride==null || outputOverride=="")
+                   _strOutputPath = 
Path.Combine(ps.ProjectRootDirectory,elemConfig.Attributes[ "OutputPath" ].Value);
+           else
+                   _strOutputPath = 
Path.Combine(ps.ProjectRootDirectory,outputOverride);
+           _strOutputPath =new DirectoryInfo(_strOutputPath).FullName;
             _ps = ps;
 
             _strName = elemConfig.GetAttribute( "Name" ).ToLower();
@@ -38,7 +43,7 @@
             _strDocFilename = null;
             if ( ( elemConfig.Attributes[ "DocumentationFile" ] != null ) &&
                 ( elemConfig.Attributes[ "DocumentationFile" ].Value.Length > 0 )) {
-                FileInfo fiDocumentation = new FileInfo( ps.ProjectRootDirectory + 
@"/" + elemConfig.Attributes[ "DocumentationFile" ].Value );
+                FileInfo fiDocumentation = new FileInfo( Path.Combine( 
ps.ProjectRootDirectory,elemConfig.Attributes[ "DocumentationFile" ].Value ));
                 _strDocFilename = fiDocumentation.FullName;
                 _alSettings.Add( @"/doc:""" + _strDocFilename + @"""" );
 
@@ -78,7 +83,7 @@
                 }
             }
 
-            _alSettings.Add( String.Format( @"/out:""{0}{1}""", OutputPath, 
ps.OutputFile ) );
+            _alSettings.Add( String.Format( @"/out:""{0}""", FullOutputFile ) );
         }
 
         public Task[] GetRequiredTasks() {
--- E:\src\nant\distrib\NAnt.VSNet\Project.cs   Fri Jul 25 10:07:28 2003
+++ E:\src\nant\src\NAnt.VSNet\Project.cs       Tue Aug 19 19:04:12 2003
@@ -120,8 +120,16 @@
             XmlNodeList nlConfigurations, nlReferences, nlFiles, nlImports;
 
             nlConfigurations = doc.SelectNodes( "//Config" );
+
+                       string outputOverride = null;
+                       if(_nanttask is SolutionTask)
+                       {
+                               SolutionTask st = (SolutionTask)_nanttask;
+                               outputOverride=st.OutputPath;
+                       }          
+           
             foreach ( XmlElement elemConfig in nlConfigurations ) {
-                ConfigurationSettings cs = new ConfigurationSettings( _ps, elemConfig 
);
+                ConfigurationSettings cs = new ConfigurationSettings( _ps, 
elemConfig, outputOverride );
                 _htConfigurations[ elemConfig.Attributes[ "Name" ].Value.ToLower() ] 
= cs;
             }
 
@@ -182,7 +190,7 @@
         }
 
         public ConfigurationSettings GetConfigurationSettings( string 
strConfiguration ) {
-            return ( ConfigurationSettings )_htConfigurations[ strConfiguration ];
+            return ( ConfigurationSettings )_htConfigurations[ 
strConfiguration.ToLower() ];
         }
 
         public Reference[] References {
@@ -293,7 +302,7 @@
 
                 Log(Level.Verbose, _nanttask.LogPrefix + "Compiling resources:" );
                 foreach ( Resource resource in _htResources.Values ) {
-                    Log(Level.Info, _nanttask.LogPrefix + " - {0}", 
resource.InputFile, Level.Verbose);
+                    Log(Level.Verbose, _nanttask.LogPrefix + " - {0}", 
resource.InputFile, Level.Verbose);
                     resource.Compile( cs, bShowCommands );
                     sw.WriteLine( resource.Setting );
                 }

Reply via email to