Last post Apr 04, 2010 12:49 AM by jkirkerx
Mar 20, 2010 04:12 AM|kometro|LINK
I have designed a Custom Control that uses some files from a folder. On prerender method it copies the folder content to the web project folder. So when we drag&drop it from Toolbox, folder is otomatically copied. Everything is fine up to that point.
But the dragged custom control can’t use the files in the folder because the folder doesn’t added to the solution explorer. How can we add folder to the project’s Solution Explorer after drag&drop at design time.
PS: If it’s necessary;
a) In the folder there are 2 user controls which are consumed by our Custom Control.
b) I use Visual Studio 2008, c# and our project is ASP.Net Web Application(not Web Site)
Mar 21, 2010 01:28 AM|Binary_Fiddle|LINK
Modifying the application folder your code is not the right approach.
I would suggest using a Batch file that will copy the files the new location.You can run this batch file in the project post build event.
If you want your files to be part of the solution/project then you will have to modfy the .sln/.proj to make the neccesary enties.
Mar 22, 2010 06:55 AM|kometro|LINK
Thanks for your answer.
i am ok about writing to proj. file. but i need to copy the files at design time while drag&drop the my custom control. i do it by getting the dll path. But this work for first time i added the control to toolbox because it knows the exact path of dll.
but then i close and open again solution. then drag again my control but this time dll path change the projectassemblies folder. any idea to get always same dll path( i mean Dll Project folder path)
Mar 22, 2010 09:24 AM|kometro|LINK
ok, i just want to get dll project folder in the dll. Any idea?
Apr 04, 2010 12:49 AM|jkirkerx|LINK
I think you have to embed the folder and contents in the dll, and use the properties to select copy output to directory
Other that that, I'm not sure. I generate the folders and files in the control code, I check to see if they exist, and if not, I make them in code on OnLoad event