From: Scott H. <sk...@eo...> - 2003-09-22 20:17:12
|
Okay, I have the following directory structure that I want to embed into a resource file. -Resources -Files -Valid file1.xml .... -Invalid file1.xml ... I want to be able to access the resources programmatically by their directory+filename combination, or something like that. What is the easiest way to do this with NAnt? I would really like to be able to do this dynamically so I don't need to track each file in the build file. |
From: Scott H. <sk...@eo...> - 2003-09-23 00:12:25
|
This works really easily using the <resources> element of csc. But there are a few tricks you need to apply. You need to add the dynamicprefix attribute of true if you want the directory names prepended to the resourcename. <csc ...> <resources prefix="XML:" dynamicprefix="true" basedir="Resources"> <includes name="**/*" </resources> </csc> Optionally, as I have done above, you can also specify a prefix value, but it is not required. It is also of interest to note you can also specify resx format files in there too. They will automatically be compiled into .resource files and embedded also. This will name the resources in the assembly as "XML:.Files.Valid.file1.xml" You can then get to them by using Assembly.GetManifestResourceStream(resName) I hope this helps some people out there. ----- Original Message ----- From: "Scott Hernandez" <sk...@eo...> To: <nan...@li...> Sent: Monday, September 22, 2003 1:13 PM Subject: [Nant-users] embedding resources > Okay, I have the following directory structure that I want to embed into a > resource file. > > -Resources > -Files > -Valid > file1.xml > .... > -Invalid > file1.xml > ... > > I want to be able to access the resources programmatically by their > directory+filename combination, or something like that. > > What is the easiest way to do this with NAnt? I would really like to be able > to do this dynamically so I don't need to track each file in the build file. |