I put together a little target that will copy the app.Config file used by visual 
studio to the build directory, renaming the file. The only external property needed is 
the build.dir property. However, I couldn't find where VS.NET stores the startup 
project, so I had to assume that folder where the app.config resides also contains the 
startup project. If anyone can point out where VS.NET stores this info, I can make 
this target bulletproof. 

Hope someone else finds this helpful,
Erick


<target name="copyConfig">
   <foreach item="Folder" property="foldername">
      <in>
         <items>
            <includes name="**" />
         </items>
      </in>

      <do>
         <foreach item="File" property="filename">
            <in>
               <items>
                  <includes name="${foldername}\app.config" />
               </items>
            </in>

            <do>
               <foreach item="File" property="projectName">
                  <in>
                     <items>
                        <includes name="${foldername}\*.csproj" />
                     </items>
                  </in>

                  <do>
                     <echo message="${projectName}" />

                     <xmlpeek filename="${projectName}" 
xpath="/VisualStudioProject/CSHARP/Build/Settings/@AssemblyName" property="appName" />

                     <echo message="${appName}" />

                     <copy file="${filename}" 
tofile="${build.dir}\${appName}.exe.config" />
                  </do>
               </foreach>
            </do>
         </foreach>
      </do>
   </foreach>
</target>


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to