c# - Copy resource to bin from dll -


assume have library foo. foo has resources copied bin when built.

assume have solution bar. reference foo in bar, , want resource files foo has in bar's bin directory. possible? specifically, can done executables?

you have couple of options @ least.

one make foo dependency of bar. in other words, add foo project bar's dependencies, set reference properties foo "copy local: true".

another way have little more control on happens post-build write own post-build script , have execute on successful build.

for example, whenever build of project foo might want copy output deployment directory. this, add following build events (project properties --> build events --> post-build event command line)

$(projectdir)postbuild.bat $(projectname) $(platform) $(configuration) 

this runs batch file, postbuild.bat, , includes variables batch file expecting. batch file looks this:

rem list of macros --> https://msdn.microsoft.com/en-us/library/c02as0cs.aspx  @echo off  rem kill built app if forgot to... tskill %1  rem make target dir if doesn't exist if not exist c:\deploymentdirectory\%1 mkdir c:\deploymentdirectory\%1  robocopy e:\repos\myfooproject\%1\%1\bin\%2\%3\ c:\deploymentdirectory\%1\ *.dll *.xml *.exe *.pdb *.config /purge  del c:\deploymentdirectory\%1\*.vshost.*  rem robocopy exits code, cause  rem vs think bad happened :-( rem following handle  if %errorlevel% geq 8 goto failed  rem end of batch file goto success  :failed rem not pause pause msbuild. exit  :success exit 0     

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -