FSC 编译警告:程序集“SMDiagnostics”被传递引用并且程序集无法自动解析
在编译我的项目(它是一个实现 Windows 服务的控制台应用程序)时,会间歇性地发布上述警告。
(此处为完整警告文本)
Warning 1 Assembly 'SMDiagnostics' was referenced transitively and the assembly could not be resolved automatically.
Static linking will assume this DLL has no dependencies on the F# library or other statically linked DLLs. Consider adding an explicit reference to this DLL.
FSC 1 1 myService (Applications\myService\myService)
此错误是什么意思以及可能导致该错误的原因是什么?
Intermittently when compiling my project (it is a Console Application implementing a Windows Service) the above warning is posted.
(here full warning text)
Warning 1 Assembly 'SMDiagnostics' was referenced transitively and the assembly could not be resolved automatically.
Static linking will assume this DLL has no dependencies on the F# library or other statically linked DLLs. Consider adding an explicit reference to this DLL.
FSC 1 1 myService (Applications\myService\myService)
What does this error mean and what could be causing it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不是100%确定,这是我的猜测。
您正在使用 System.ServiceModel,并将其添加为项目中的引用。 ServiceModel 反过来使用 SMDiagnostics 程序集,但您没有在项目中明确引用它。您可能正在使用 --standalone 进行编译,因此它警告您无法找到所有程序集的传递闭包?
无论如何,我希望如果您添加对 SMDiagnostics 的显式引用,警告就会消失。无论如何,这可能是一个无害的警告(我认为 SMDiagnostics 可能位于 GAC 中,因此无论如何都会在运行时找到它)。
I am not 100% sure, here is my guess.
You are using System.ServiceModel, and have it added as a reference in your project. ServiceModel, in turn, uses the SMDiagnostics assembly, but you don't have that explicitly referenced in your project. You're maybe compiling with --standalone, and so it's warning you about not being able to find the transitive closure of all the assemblies?
Anyway, I expect that if you add an explicit reference to SMDiagnostics, the warning will go away. It's probably a harmless warning anyway (I think SMDiagnostics is probably in the GAC so it will be found at runtime regardless).
设置 --lib 会抑制 FS2011 警告。它有效地告诉 fsc.exe 在哪里搜索这两个 DLL 文件,以便它可以在构建时链接它们。我们喜欢静态构建选项,因为它使我们能够将软件解压缩到新的 Windows 盒子并使其无需其他配置即可运行。
您可以简单地将以下内容添加到编译命令中来代替环境变量。
--lib:c:\Windows\Microsoft.NET\Framework\v4.0.30319
您需要将包含必要 DLL 的目录替换为我们使用的目录。我使用以管理员身份运行的 cygwin find 命令来查找目录。
解决了 F# (FSC.EXE) 编译器中的以下警告
乔 E
Setting the --lib suppresses the FS2011 warning. It effectively tells fsc.exe where to search for the two DLL files so it can link them in at build time. We like the static build option because it enables our goal of being able to unzip our software to a new windows box and have it run with no other configuration required.
In lieu of the environment variables you can simply add the following to your compile command.
--lib:c:\Windows\Microsoft.NET\Framework\v4.0.30319
You will need to substitute the whatever directory contains the necessary DLL for the one we used. I used the cygwin find command ran as administrator to find locate the directory.
Resolved the following warnings from F# (FSC.EXE) compiler
Joe E