当我将" AddJsonFile(" foo.json")作为IconfigurationBuilder上的方法放入时,会抛出此错误:
严重级代码说明项目文件行 错误CS1061' ConfigurationBuilder'不包含' AddJsonFile'的定义并且没有扩展方法' AddJsonFile'接受类型' ConfigurationBuilder'的第一个参数。可以找到(你是否缺少using指令或程序集引用?)WebDemo.DNX 4.5.1 E:\ ASP.NET \ WebDemo \ src \ WebApplication1 \ Startup.cs 21
在进行潜在的修复并添加DNX 4.5.1软件包后,我收到此错误:
严重级代码说明项目文件行 错误CS1061' ConfigurationBuilder'不包含' AddJsonFile'的定义并且没有扩展方法' AddJsonFile'接受类型' ConfigurationBuilder'的第一个参数。可以找到(您是否缺少using指令或程序集引用?)WebDemo.DNX Core 5.0 E:\ ASP.NET \ WebDemo \ src \ WebApplication1 \ Startup.cs 21
如果删除该方法,运行应用程序时会出现此错误:
System.TypeLoadException:无法加载类型' Microsoft.Framework.Configuration.IConfigurationSource'来自assembly' Microsoft.Framework.Configuration.Abstractions,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = null'。 在Microsoft.AspNet.Loader.IIS.RuntimeHttpApplication.ApplicationStart(IHttpApplication应用程序) 在Microsoft.AspNet.Loader.IIS.HttpApplicationBase.InvokeApplicationStart(IHttpApplication application)
这是我的Project.Json文件:
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
"jQuery": "2.1.4",
"Microsoft.AspNet.Mvc": "6.0.0-beta8",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
"Microsoft.Dnx.Runtime.Abstractions": "1.0.0-beta8"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --config hosting.ini"
},
"frameworks": {
"dnx451": {
"dependencies": {
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5"
}
},
"dnxcore50": {
"dependencies": {
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8",
"Microsoft.Framework.Configuration": "1.0.0-beta8"
}
}
},
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
],
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
]
}
我也收到了这些警告!
严重级代码说明项目文件行 警告元素'目标'在命名空间' http://schemas.microsoft.com/developer/msbuild/2003'具有无效的子元素' GetBuildOptions'在命名空间' http://schemas.microsoft.com/developer/msbuild/2003'。预期可能元素的列表:'任务,AL,AspNetCompiler,AssignCulture,AssignProjectConfiguration,AssignTargetPath,AxImp,CallTarget,CombinePath,ConvertToAbsolutePath,Copy,CreateCSharpManifestResourceName,CreateItem,CreateProperty,CreateVisualBasicManifestResourceName,Csc,Delete,Error,Exec,FindAppConfigFile, FindInList,FindUnderPath,FormatUrl,FormatVersion,GenerateApplicationManifest,GenerateBootstrapper,GenerateDeploymentManifest,GenerateResource,GenerateTrustInfo,GetAssemblyIdentity,GetFrameworkPath,GetFrameworkSdkPath,GetReferenceAssemblyPaths,LC,MAKEDIR,消息,移动,MSBuild的,ReadLinesFromFile,RegisterAssembly,RemoveDir,RemoveDuplicates,RequiresFramework35SP1Assembly,ResolveAssemblyReference,ResolveComReference, ResolveKeySource,ResolveManifestFiles,ResolveNativeReference,ResolveNonMSBuildProjectOutput,SGen,SignFile,TlbImp,Touch,UnregisterAssembly,UpdateManifest,Vbc,VCBuild,Warning,WriteCodeFragment,WriteLinesToFile,XslT转换,CodeAnalysis,CL,Link,BSCMake,CPPClean,Get ....其他文件C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v14.0 \ DNX \ Microsoft.DNX.targets 140