c# - unwanted culture specific dlls copied to bin directory -
i using visual studio 2013 & fluent validation 5.6.2
i see after build in bin folder copies culture specific fluentvalidation.resources.dll
seems mentioned in .nuspec
file
> <file src="lib\net35\de\fluentvalidation.resources.dll" > target="lib\net35\de\fluentvalidation.resources.dll" /> > <file src="lib\net35\es\fluentvalidation.resources.dll" target="lib\net35\es\fluentvalidation.resources.dll" /> > <file src="lib\net35\fr\fluentvalidation.resources.dll" target="lib\net35\fr\fluentvalidation.resources.dll" /> > <file src="lib\net35\it\fluentvalidation.resources.dll" target="lib\net35\it\fluentvalidation.resources.dll" /> > <file src="lib\net35\nl\fluentvalidation.resources.dll" target="lib\net35\nl\fluentvalidation.resources.dll" /> > <file src="lib\net35\pt\fluentvalidation.resources.dll" target="lib\net35\pt\fluentvalidation.resources.dll" /> > <file src="lib\net35\sv\fluentvalidation.resources.dll" target="lib\net35\sv\fluentvalidation.resources.dll" />
but not need these in bin
folder, because project not support culture specific messages.
so how can tell vs-build ignore these culture specific dlls?
my solution add target @ end of .csproj file before closing project tag.
<target name="afterpackage" aftertargets="copyallfilestosinglefolderforpackage" /> <itemgroup> <fluentvalidationexcludedcultures include="cs;da;de;es;fa;fi;fr;it;ko;mk;nl;pl;pt;ru;sv;tr;zh-cn"> <inproject>false</inproject> </fluentvalidationexcludedcultures> </itemgroup> <target name="removetranslationsafterbuild" aftertargets="afterbuild"> <removedir directories="@(fluentvalidationexcludedcultures->'$(outputpath)%(filename)')" /> </target> <target name="removetranslationsafterpackage" aftertargets="afterpackage"> <removedir directories="@(fluentvalidationexcludedcultures->'$(_packagetempdir)\$(outputpath)%(filename)')" /> </target>
it's not pretty, gets job done. if need culture specific resource, remove corresponding line list. if future update adds new culture don't want, add list.
the best option ask developer separate resources in multiple nugets, way add ones needed. i'll stick solution, now, until come better one.
now can find solution @ official project wiki: https://github.com/jeremyskinner/fluentvalidation/wiki/f.-localization (at bottom of page)
Comments
Post a Comment