Note that there are some explanatory texts on larger screens.

plurals
  1. POIn NAnt, can I create a fileset of the files listed in a VS project?
    text
    copied!<p>I'm rewriting our <a href="http://nant.sourceforge.net/" rel="nofollow noreferrer">NAnt</a> build scripts to make them cleaner and simpler, as well as more general purpose. </p> <p>One of the steps in our build process is to package certain files into a zip file. Before we had created a <a href="http://nant.sourceforge.net/release/latest/help/types/zipfileset.html" rel="nofollow noreferrer"><code>fileset</code></a> with lots of included file types, trying to catch everything that might be in the project. This occasionally caused problems when we wanted to include a non-standard file type with the project.</p> <p>I was hoping that I could find a way to create a <a href="http://nant.sourceforge.net/release/latest/help/types/zipfileset.html" rel="nofollow noreferrer"><code>fileset</code></a> based on the files (and, also, a <em>subset</em> of the files) listed in the Visual Studio project file (.csproj). I could then use this fileset in a <a href="http://nant.sourceforge.net/release/latest/help/tasks/zip.html" rel="nofollow noreferrer"><code>zip</code></a> task. I haven't found anything that does this automatically (though the now-deprecated <a href="http://nantcontrib.sourceforge.net/release/latest/help/tasks/slingshot.html" rel="nofollow noreferrer"><code>SLiNgshoT</code></a> task in <a href="http://nantcontrib.sourceforge.net/" rel="nofollow noreferrer">NAntContrib</a> looked a little promising).</p> <p>I started down the path of trying to do this manually, but have gotten stuck. I have a target that gets the project from the solution (using <a href="http://nant.sourceforge.net/release/latest/help/tasks/regex.html" rel="nofollow noreferrer"><code>regex</code></a>), then tries to get each Content file in the project using <a href="http://nant.sourceforge.net/release/latest/help/tasks/xmlpeek.html" rel="nofollow noreferrer"><code>xmlpeek</code></a> (with the XPath query <code>/n:Project/n:ItemGroup/n:Content/@Include</code>). The problem here is that <a href="http://nant.sourceforge.net/release/latest/help/tasks/xmlpeek.html" rel="nofollow noreferrer"><code>xmlpeek</code></a> doesn't return every value, just the first. And, even if it did return every value, I'm not sure how I'd get it into a <a href="http://nant.sourceforge.net/release/latest/help/types/zipfileset.html" rel="nofollow noreferrer"><code>fileset</code></a> from here.</p> <p>Is there any way to salvage this track of thinking? Can I accomplish what I want with a custom NAnt task (I'd prefer not to have every project dependent on a custom task)? Is there some built-in way to do this that I'm not finding?</p> <p>Please feel free to ask questions in the comments if something about my goal or method isn't clear.</p> <p>Thanks!</p> <hr> <p><strong>UPDATE:</strong> To clarify, my point in all of this is to make the whole process much more seamless. While I can easily add all .xml files to a package, this often gets .xml files that live in the same folder but aren't really part of the project. When I already have a list of the files that the project uses (separated out between Content and other types, even), it seems a shame not to use that information. Ultimately, no one should have to touch the build file to change what gets included in a package. It doesn't seem like too much of a pipe dream to me...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload