问题描述
我正在开发一个自定义的PowerShell管理单元,当我尝试调试它引用另一个项目中的解决方案。
中的管理单元(以下[这些说明] [1]),大会加载失败,我的小命令失败,出现消息无法加载文件或程序......
I'm developing a custom PowerShell snap-in, which references another project in the solution.
When I try to debug the snap-in (following [these instructions][1]), the assembly fails to load and my cmdlet fails with the message "Could not load file or Assembly..."
请问你如何定位组件指示PowerShell或你如何指定的位置由管理单元所需要的组件?
How do you instruct PowerShell on how to locate assemblies, or how do you specify where are located the assemblies needed by the snap-in?
我宁愿避免在GAC注册组件,至少在开发过程中。
I'd prefer to avoid registering the assemblies in the GAC, at least during development.
推荐答案
不知道确切的行为,但我会尝试利用 fuslogvw
来看看究竟在何处运行时寻找有问题的组件。这会给你一个线索,如何让他们被复制到上建立正确的位置。 是相当有用的,是官方文档。
Not sure of the exact behaviour, but I would try and make use of fuslogvw
to see exactly where the runtime is looking for the problematic assemblies. That would give you a clue as to how to get them to be copied into the correct place on build. This post by Scott Hanselman is quite useful, and this is the official documentation.
如果您找到解决方案,请加一个答案,因为这必须是一个常见的场景。
If you find the solution, please add an answer, as this must be a common scenario.
这篇关于从PowerShell管理单元引用外部组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!