我创建了一个定义为Windows Runtime Component
的类库,其中包含一个类:
using System;
using System.Diagnostics;
namespace ClassLibrary1
{
public sealed class Snaggs
{
public void foo()
{
Debug.WriteLine("Hello Snaggs");
}
}
}
我参考ClassLibrary1
创建了其他项目,我称之为:
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
ClassLibrary1.Snaggs lib = new ClassLibrary1.Snaggs();
lib.Foo();
}
在日志中,我看到:Hello Snaggs
到目前为止一切顺利。
现在我创建了基本的nuspec
:
<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>AFDemoClassLibrary</id>
<version>999.2.4</version>
<authors>tester</authors>
<owners>Maxim</owners>
<description>This is a test</description>
<licenseUrl>http://www.snaggs.test.com</licenseUrl>
<projectUrl>http://www.snaggs.test.com</projectUrl>
<iconUrl>https://www.snaggs.test.com/logo.svg</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
</metadata>
<files>
<file src="bin\Release\**" target="lib\uap10.0" />
</files>
</package>
我跑了:$ nuget pack AFDemoClassLibrary.nuspec
并将.nupkg
个文件上传到Nuget
现在我创建了新项目并使用以下命令安装了这个库:
PM> Install-Package AFDemoClassLibrary
GOT:
Successfully installed 'AFDemoClassLibrary 999.2.4' to TestClassLibrary1
现在我再次使用以下方法调用此库:
ClassLibrary1.Snaggs lib = new ClassLibrary1.Snaggs();
lib.Foo();
但是没有得到任何输出,我没有看到Hello Snaggs
这是我得到的输出:
'TestClassLibrary1.exe' (CoreCLR: DefaultDomain): Loaded 'C:\Program Files\WindowsApps\Microsoft.NET.CoreRuntime.1.0_1.0.23819.0_x86__8wekyb3d8bbwe\mscorlib.ni.dll'. Cannot find or open the PDB file.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\entrypoint\TestClassLibrary1.exe'. Symbols loaded.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\System.Runtime.dll'. Cannot find or open the PDB file.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\WinMetadata\Windows.winmd'. Module was built without symbols.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\System.Runtime.InteropServices.WindowsRuntime.dll'. Cannot find or open the PDB file.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\ClassLibrary1.winmd'. Symbols loaded.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\System.Diagnostics.Debug.dll'. Cannot find or open the PDB file.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\System.Runtime.WindowsRuntime.dll'. Cannot find or open the PDB file.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\System.Runtime.WindowsRuntime.UI.Xaml.dll'. Cannot find or open the PDB file.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\System.Collections.dll'. Cannot find or open the PDB file.
'TestClassLibrary1.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\workspace\DEMOS\TestClassLibrary1\TestClassLibrary1\bin\x86\Debug\AppX\System.Private.Uri.dll'. Cannot find or open the PDB file.
我的问题在哪里?
也许我的环境有问题?
尝试安装此插件AFDemoClassLibrary
谢谢,
[编辑]
本地我可以打印日志。