我試着在我的Mac上運行新的核心CLR類型ASP.Net並運行到問題的結束。ASP.Net與StructureMap.Dnx的DNX核心CLR問題:類型'對象'是在一個未引用的程序集中定義
我已經成功地得到引用StructureMap,並通過DNU和DNU恢復安裝,但在VS的代碼現在我得到的錯誤,指出:
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'. [dnx451]
我已經做了谷歌搜索量好,但我能找到的所有東西都是說明我需要爲系統添加一個使用,但不能解決問題。
Startup.cs:
using System;
using System.Reflection;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;
using StructureMap;
namespace Authorization
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public IServiceProvider ConfigureServices(IServiceCollection services)
{
var container = new Container();
container.Configure(x => {
x.Scan(scanning => {
scanning.Assembly(Assembly.GetExecutingAssembly());
scanning.TheCallingAssembly();
scanning.WithDefaultConventions();
});
});
container.Populate(services);
return container.GetInstance<IServiceCollection>(services);
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
// Entry point for the application.
public static void Main(string[] args) => Microsoft.AspNet.Hosting.WebApplication.Run<Startup>(args);
}
}
project.json:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"tooling": {
"defaultNamespace": "Authorization"
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"StructureMap.Dnx": "0.4.0-alpha4"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {}
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
任何幫助感激地接受!
謝謝
你有沒有嘗試刪除dnxcore50並剛剛運行dnx451?當它瞄準兩個框架之一時可能會失敗。 – BenM
同樣的事情 - 跑了dnu再次恢復,沒有變化 –
假設你也嘗試了相反的做法嗎? – BenM