您收到此错误是因为 Microsoft.Silverlight.WindowsPhone.Build.Tasks.dll 是包含 GetSilverlightFrameworkPath 的程序集,例如在 Silverlight 4 和 5 SDK 中:
// Decompiled with JetBrains decompiler
// Type: Microsoft.Silverlight.Build.Tasks.GetSilverlightFrameworkPath
// Assembly: Microsoft.Silverlight.Build.Tasks, Version=9.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 2E9B62C4-1C0C-4AAD-8CBE-F7E074602879
// Assembly location: C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0
//omitted for brevity
namespace Microsoft.Silverlight.Build.Tasks
{
public sealed class GetSilverlightFrameworkPath : Task
{
private const string SDKAssemblyFoldersExRegKey = "v5.0\\AssemblyFoldersEx";
public const string SDKLibrariesRegKey = "v5.0\\AssemblyFoldersEx\\Silverlight SDK Client Libraries";
public const string SDKRuntimeInstallPathRegKey = "SOFTWARE\\Microsoft\\Microsoft SDKs\\Silverlight\\v5.0\\ReferenceAssemblies";
public string RegistryBase { get; set; }
public string SilverlightPath { get; set; }
public string[] SilverlightSDKPaths { get; set; }
public string SilverlightRuntimeVersion { get; set; }
public override bool Execute()
{
//omitted for brevity
}
private string GetSilverlightPath()
{
//omitted for brevity
}
private string GetSDKRuntimeVersion()
{
//omitted for brevity
}
private string[] GetAllSilverlightSDKPaths()
{
//omitted for brevity
}
}
}
然而,它在 WP v8.0 中的实现似乎确实有很大不同:
// Decompiled with JetBrains decompiler
// Type: Microsoft.Silverlight.Build.Tasks.GetSilverlightFrameworkPath
// Assembly: Microsoft.Silverlight.WindowsPhone.Build.Tasks, Version=9.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 899BFFD0-786C-472A-8935-576EED0F4F90
// Assembly location: C:\Program Files (x86)\MSBuild\Microsoft\WindowsPhone\v8.0\Microsoft.Silverlight.WindowsPhone.Build.Tasks.dll
//omitted for brevity
namespace Microsoft.Silverlight.Build.Tasks
{
public sealed class GetSilverlightFrameworkPath : Task
{
public string RegistryBase { get; set; }
public string RuntimePathRegistryKey { get; set; }
public string RuntimeVersionRegistryKey { get; set; }
public string AdditionalRegistryBasePaths { get; set; }
public string SilverlightPath { get; set; }
public string[] SilverlightSDKPaths { get; set; }
public string SilverlightRuntimeVersion { get; set; }
public override bool Execute()
{
// omitted for brevity
}
private string GetSilverlightPath()
{
// omitted for brevity
}
private string GetSDKRuntimeVersion()
{
// omitted for brevity
}
internal string[] GetAllSilverlightSDKPaths()
{
// omitted for brevity
}
}
因此,事情不起作用是很自然的。
您需要做的是检查您在所有项目中是否引用了相同的 SDK 版本。
您在构建期间尝试实例化的任务位于 SL SDK 5 中,而目前由于某种原因构建过程正在尝试使用 WP8.0 SDK。
此外,您引用的代码是 references Toolset 12.0 的 csproj 的一部分:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
你确定这是想要的吗?
This info 也可能与您有关。
如果您提供有关实际项目的更多信息,它可能很容易修复。现在,要判断一切是如何设置的有点困难。