生成后事件,使用探测将所有额外的 .dll 放入 bin 目录中
我的项目中有带有一堆其他 dll 的 WPF 程序集,
我想将除主程序集和 app.config 之外的所有内容从构建目录移动到名为 bin 的子目录,
当我将探测标记添加到 app.config 时,这很容易并手动完成(剪切和粘贴工作)
<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="..." />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin"/>
</assemblyBinding>
</runtime>
</configuration>
我现在想做的是在构建结束时自动将所有不是程序集的内容移动到 bin 目录中。
所以从现在
App.exe
App.config
Domain.dll
Application.dll
Framework.dll
开始,
App.exe
App.config
bin\Domain.dll
bin\Application.dll
bin\Framework.dll
我猜我可以使用一个包含一堆移动命令的bat文件,但我希望有一些比那里更可重用和更智能的东西。
I have WPF assembly with a bunch of other dlls in my project
I want to move everything except the main assembly and the app.config from the build directory to a subdirectory called bin
this is easy when I add the probing tag to my app.config and do it manually (a cut and paste job)
<configuration>
<connectionStrings>
<add name="ConnectionString" connectionString="..." />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="bin"/>
</assemblyBinding>
</runtime>
</configuration>
What i want to do now is automatically move everything that's not the assembly into the bin directory at the end of my build.
so from this
App.exe
App.config
Domain.dll
Application.dll
Framework.dll
to this
App.exe
App.config
bin\Domain.dll
bin\Application.dll
bin\Framework.dll
I'm guessing I could use a bat files with a bunch of move commands in it but i was hoping that there was something a bit more reusable and intelligent than that out there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于任何感兴趣的人,我最终要做的是这是
一个看起来像这样的构建后事件
,我将构建目录设置为实际的子目录,所以它看起来像
所以而不是计算出向下移动目录的内容(这可能是一大堆东西)我只是拿了我知道我想要一个目录的部分。
我的大笑脸万岁!
For anyone interested what I ended up doing was this
a Post Build Event that looks like this
and I set the build directory to be the actual sub directory so it looked like
So instead of working out what to move down a directory (which could be a whole bunch of things) I just took the bits I know I want up a directory.
Big smiley face for me Hooray!