Outputting XML project library to asp.net bin folder in assembly?

I have a visual studio 2005 solution that has a web application and a class library project. The web application has a link to the library project. I would like the XML document of the library project code to output to the bin folder of the web application along with the library DLL. I cannot find an easy way to do this.

0


source to share


4 answers


A post-assembly step, perhaps? A bit ugly, but I think it will work.



+1


source


Use the post build event on the library project, which will copy the Xml file to the bin folder of the web application.

For example, you can use something like: copy $ (TargetDir) \ $ (SolutionDir) \



This is untested, so you will need to configure it.

+1


source


Not sure if this was possible in VS 2005, but in VS 2010:

Right click on your XML file and go to properties Change "Copy to Output Directory" to "Copy if New" or "Copy Always"

+1


source


Following is the post-build command:

copy "$(TargetDir)$(TargetName).xml" "$(SolutionDir)MyWebProject1\bin\$(TargetName).xml"
copy "$(TargetDir)$(TargetName).xml" "$(SolutionDir)MyWebProject2\bin\$(TargetName).xml"

      

A couple of problems inherent in this solution:

  • xml is always copied even if this site is not part of the current build ... so the documentation might get out of sync with the dll in the trash folder until the next time the project is built.
  • If we add a new web project that belongs to this library, we need to add another post-build command instead of all this happening automatically.

I accept this as kludgy, but a workable solution ... if anyone has a more elegant suggestion please let me know!

0


source







All Articles