[英]CS0012 The type 'EventLogEntryType' is defined in an assembly that is not referenced
currently I am using .net standard and .net framework in the project .目前我在项目中使用 .net 标准和 .net 框架。 In .net standard I have created a function
在 .net 标准中,我创建了一个函数
public static void WriteEntryLog(string source, string message, EventLogEntryType entryType)
when I am trying to use it on .net framework installer class , that time it gives an error当我尝试在 .net 框架安装程序类上使用它时,它会出现错误
Error CS0012 The type 'EventLogEntryType' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Diagnostics.EventLog, Version=4.0.2.0, Culture=neutral,
PublicKeyToken=cc7b13ffcd2ddd51'.
if i install the latest nuget package of "System.Diagnostics.EventLog" it got work in compile time but during the installation its unable to find the System.Diagnostics.EventLog package and failed to install.如果我安装“System.Diagnostics.EventLog”的最新 nuget 包,它可以在编译时工作,但在安装过程中它无法找到 System.Diagnostics.EventLog 包并且无法安装。
you mentioned the latest version你提到了最新版本
if i install the latest nuget package of "System.Diagnostics.EventLog"
如果我安装“System.Diagnostics.EventLog”的最新 nuget 包
Normally, the Visual Studio creates the assembly binding redirects automatically for you.通常,Visual Studio 会自动为您创建程序集绑定重定向。 You can find those binding redirects in the .config files in the project's target directory after build.
构建后,您可以在项目目标目录中的 .config 文件中找到这些绑定重定向。 Those assembly redirects contain the infrmation for the runtime to use the exact version you have included at your project as "latest" when the 4.0.2 is requested by the application.
当应用程序请求 4.0.2 时,这些程序集重定向包含运行时使用您在项目中包含的确切版本作为“最新”的信息。 When you creating the installer it is easy to miss the config file.
创建安装程序时,很容易错过配置文件。
You may try either:您可以尝试以下任一方法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.