Where to Add a folder in .net solution so that while building the project folder should be created?
views:
233answers:
6Where to Add a folder in .net solution so that while building the project folder should be created?
Not sure what you mean there, but generally speaking, creating a folder inside the solution only creates a virtual folder - no actual folder is created on your file system. If you want the actual folders to match the ones appearing in your solution, just manually create a folder using the windows explorer (Or any other way you like) at the same spot, using the same name.
I have no idea what those solution virtual folders are good for.
Annoyingly, a folder won't be created if it doesn't have anything in it (at least, IIRC). I've added a 'blank.txt' to a folder before, and then you can just delete that, post-build.
You could just use a post-build step:
mkdir $(TargetDir)\MyDirectory
If the folder isn't needed until runtime you can generally just do a Directory.Exists
check for it in your program start up logic and create the folder(s) as required.
Otherwise a folder added to the solution has to have something in it which has Build Action of None (or Content I think) and which has the Copy to Output Directory property set
I also face same issues as suppose i have one report folder with all the .rpt files and after building the project that Report folder need to be copied in debug or release folder based on debugging mode..
And i applied the same logic for Mkdir in Postbuild event and added another commands to copy the things from original location of folder to the new folder being created..