Nei*_*ir0 28 c# internals linqpad
是否可以使我的程序集内部类对其他程序集可见?
我知道AssemblyInfo文件和[assembly: InternalsVisibleTo()]属性,但它在我的情况下不起作用.
主要目的是使从LINQPAD调用方法成为可能,因此这[assembly: InternalsVisibleTo("LINQPad")]不起作用.我不知道为什么.在我的项目中,我使用依赖解析器,在LINQPAD中很难做到这一点.有什么建议?
Joe*_*ari 61
将以下属性添加到您希望LINQPad访问其内部的库中:
[assembly: InternalsVisibleTo("LINQPadQuery")]
Run Code Online (Sandbox Code Playgroud)
您还需要在LINQPad的首选项(编辑|首选项|高级)中启用此功能.
让我知道你是如何相处的.
小智 8
您还可以转到 AssemblyInfo.cs 文件中的项目属性并在那里进行设置。
例如:
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("*****)]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("*****")]
[assembly: AssemblyProduct("*****")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("[HERE IS YOUR ASSEMBLY WHERE YOU WANT TO SEE INTERNALS OF CURRENT ASSEMBLY")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("6fbd2c14-031d-48cc-9cc6-f1b85d701e89")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
27653 次 |
| 最近记录: |