[英]Could not load an assembly despite it being referenced
I'm looking at incorporating the new Google Apps Script Execution API into an existing C# plugin i have already working. 我正在考虑将新的Google Apps脚本执行API集成到我已经可以使用的现有C#插件中。 I am following the .NET quickstart guide provided as a console application (which i have gotten working without problem).
我正在遵循作为控制台应用程序提供的.NET快速入门指南 (我已经可以正常使用了)。
When porting the code from that into my plugin it will also fail at runtime at the first instance of: 将代码从其中移植到我的插件时,它在以下情况的第一个实例上也会在运行时失败:
UserCredential credential;
which I slimmed down the code so far to just that line which fails giving: 到目前为止,我已将代码精简到无法给出的那一行:
"Could not load file or assembly 'Google.Apis.Auth, Version=1.9.2.27817, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab' or one of its dependencies. The system cannot find the file specified."
“无法加载文件或程序集'Google.Apis.Auth,版本= 1.9.2.27817,文化=中性,PublicKeyToken = 4b01fa6e34db77ab'或其依赖项之一。系统找不到指定的文件。”
The file is properly referenced (having installed via nuget). 正确引用了该文件(已通过nuget安装)。
C# is not my normal field and perhaps i'm missing something in the subtlety of it working in a Console App. C#不是我的常客领域,也许我在控制台应用程序中缺少它的精妙之处。
What gives? 是什么赋予了?
There was a time when console apps defaulted to using the client profile rather than the full .Net framework. 曾经有一段时间,控制台应用程序默认使用客户端配置文件而不是完整的.Net框架。 Check the properties of the project on the Application tab and make sure the target framework doesn't end with Client profile.
在“应用程序”选项卡上检查项目的属性,并确保目标框架不以“客户端”配置文件结尾。 If that doesn't work try using the fusion log viewer , which you'll find conviently located at C:\\Program Files (x86)\\Microsoft SDKs\\Windows\\v7.0A\\Bin, or any number of other places .
如果这样不起作用,请尝试使用融合日志查看器 ,您会发现它位于C:\\ Program Files(x86)\\ Microsoft SDKs \\ Windows \\ v7.0A \\ Bin 或任何其他位置 。 Run it as an admin and it'll tell you what it can't load (which may or may not be Google.Apis.Auth) and where it looked for the file at.
以管理员身份运行它,它将告诉您无法加载的内容(可能是Google.Apis.Auth,也可能不是),以及在何处查找文件。
This has been a little bit of a red herring. 这有点像鲱鱼。 Not very well documented is the fact for the app i am building against, Autodesk Navisworks, plugin dependency libraries have to be duplicated in a separate directory altogether from the plugins directory.
我所针对的应用程序(Autodesk Navisworks)的事实并没有得到很好的记录,插件依赖库必须从plugins目录复制到一个单独的目录中。
Easily fixed for the build environment, but will need a little more thought for when creating a distributable. 易于针对构建环境进行修复,但是在创建可分发文件时需要多加考虑。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.