【发布时间】:2015-12-07 17:22:33
【问题描述】:
我在玩 NuGet,所以我创建了一个项目,编写了两个简单的函数(乘法和加法),并使用以下规范对其进行了打包:
<metadata>
<id>Math</id>
<version>1.0.0.0</version>
<title>$title$</title>
<authors>$author$</authors>
<owners>$author$</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>$description$</description>
<copyright>Copyright 2015</copyright>
<tags>Matematica, Test</tags>
</metadata>
然后在我的本地 NuGet.Server 提要上公开它,在另一个示例项目中添加我的新 nuget 包,启动它并返回:
Could not load file or assembly 'Math, Version=1.0.0.0, Culture=en-GB, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Google 搜索了很长时间,但一无所获(我是唯一一个愚蠢到可以将临时包称为“数学”的人吗?),所以我想我的模块名称在某种程度上是 禁忌,将其更改为 Math_Test ,相同的源代码,它就像一个魅力。
是否有更多信息可以指定哪些值是禁忌? 我在 nuget 官方文档上找不到任何内容。
Math 类在以下 dll (mscorlib.dll) 中指定,因此它甚至没有相同的 id...
#region Assembly mscorlib.dll, v4.0.0.0
// C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5\mscorlib.dll
#endregion
编辑: 这是示例应用程序的代码
using Math;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a = -1;
try
{
Common e = new Math.Common();
a = e.Multiply(3, 2);
}
catch (Exception e)
{
System.Console.Out.Write(e);
}
System.Console.Out.Write(a);
System.Console.Read();
}
}
}
【问题讨论】:
-
massimo:启用选项的诊断输出并检查有什么冲突
-
@ShyamalDesai :嗨,我有点困惑,我在哪里或如何做到这一点?控制台应用程序一启动就出错,我更新了问题中的示例代码
-
tools->options->Projects And Solutions->Build And run:在该页面上有一个 MSBuild 选项,用于定义输出详细程度(drop town)。选择诊断以找到罪魁祸首。它会排放很多,所以希望花一些时间来弄清楚。
-
感谢 Shyamal,感谢您,我找到了罪魁祸首并解决了问题。如果您对导致异常的原因感到好奇,我发布了答案
-
感谢您发布答案。 +1。绝对猜不到。
标签: nuget nuget-server