C#中可以用InternalsVisibleTo使得internal的东西对testproject可见
在Target project的AssemblyInfo.cs中添加
[assembly: InternalsVisibleTo("TestProject")]
注意,如果要去掉AssemblyKeyFile和AssemblyKeyName,即使这两个是空也不行,不然会报这个错误。
Error 1 Friend assembly reference 'TestProject' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.
去掉下面两行就好了。
//[assembly: AssemblyKeyFile("")]
//[assembly: AssemblyKeyName("")]
[assembly: InternalsVisibleTo("TestProject")]
注意,如果要去掉AssemblyKeyFile和AssemblyKeyName,即使这两个是空也不行,不然会报这个错误。
Error 1 Friend assembly reference 'TestProject' is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.
去掉下面两行就好了。
//[assembly: AssemblyKeyFile("")]
//[assembly: AssemblyKeyName("")]