这里看到一个老外也碰到了同样问题,明明在IDE里看到CopyLocal=true,却发现没有拷贝过去,“took me a while to figure out that Visual Studio 2008 is adirty liar when it comes to CopyLocal.”
真正有效的是<Private>True</Private>,如果没有它,就不保险一定会拷贝过去。
因为IDE里的CopyLocal碰到没有<private>设置的,就就…It turns out that the default for the CopyLocal setting is… something not quite True and not quite False.
是个三值的东西,
而具体决定它取什么实际值的是根据这里
这样,就有可能出现一台机器Ok,另一台机器不行的情况,因为里面有一条If the assembly is found in the global assembly cache, the value is false.
一个work around就是保证每个CopyLocal=true对应的csproj里都确实写着<Private>True</Private>,无论是通过文本编辑的方式,还是通过修改成false再改成true的方式。这样才能放之四海而皆准,每台机器的输出都一样。