我正在处理的其中一个项目包含来自HttpConfigurationExtensions
的扩展类System.Web.Http 5.2.2
要将它添加到另一个项目,我安装了nuget
PM> Install-Package Microsoft.AspNet.WebApi -Version 5.2.2
但是,尽管程序集相同,但它似乎没有添加HttpConfigurationExtensions
。
我想我在这里做错了什么。可能是什么以及如何将HttpConfigurationExtensions
添加到您的项目中?
这是反汇编程序为System.Web.Http.cs
显示的两个项目
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
// Assembly System.Web.Http, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// MVID: 214E5BA0-B5E8-43DD-B986-3648DF7435EE
// References: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// References: System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// References: System.Net.Http.Formatting, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// References: System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// References: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// References: System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// References: Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
// References: System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
// References: System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
[assembly: AssemblyTrademark("")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyConfiguration("")]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: AssemblyProduct("Microsoft ASP.NET MVC")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Extension]
[assembly: TargetFramework(".NETFramework,Version=v4.5", FrameworkDisplayName = ".NET Framework 4.5")]
[assembly: SatelliteContractVersion("5.2.2.0")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyFileVersion("5.2.20826.0")]
[assembly: AssemblyInformationalVersion("5.2.2-20826 (66298100f4e349d3812b1aad32c5278c256a2cdd)")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("System.Web.Http")]
[assembly: Guid("70cecdcd-46f5-492b-9e1f-1d9a947f1fd1")]
[assembly: InternalsVisibleTo("System.Web.Http.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleTo("System.Web.Http.Integration.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: AssemblyVersion("5.2.2.0")]
但是,当我通过Assembly Explorer(来自Resharper)浏览程序集时,它没有显示项目中System.Web.Http
中的任何类,我添加了nuget(缺少HttpConfigurationExtensions
)。
答案 0 :(得分:1)
我在尝试手动使用Web API的项目时遇到了同样的问题。
尝试通过Nuget重新安装:
update-package microsoft.aspnet.webapi -reinstall