我正在尝试将一个vanilla类库(ClassLibrary1,使用.Net 4.6.1构建,虽然我已经尝试过4.5.1)添加到ASP.NET 5 Web项目(1.0.0-rc1-update1,尽管我“我们也尝试过1.0.0-rc1-final”,两者都是同一解决方案的一部分。
我尝试了VS中常用的添加引用,但这不起作用。我明白了:
然后我尝试使用这样的dnu包装:
{
"version": "1.0.0-*",
"frameworks": {
"net461": {
"wrappedProject": "../../ClassLibrary1/ClassLibrary1.csproj",
"bin": {
"assembly": "../../ClassLibrary1/obj/{configuration}/ClassLibrary1.dll",
"pdb": "../../ClassLibrary1/obj/{configuration}/ClassLibrary1.pdb"
}
}
}
}
这生成了以下project.json:
"frameworks": {
"dnx451": {
"dependencies": {
"ClassLibrary1": "1.0.0-*"
}
},
"dnxcore50": {
"dependencies": {
"ClassLibrary1": "1.0.0-*"
}
}
}
然后我将其添加到ASP.NET 5 project.json
"frameworks": {
"net461": { "dependencies": { "ClassLibrary1": "1.0.0-*" } },
"dnx451": { "dependencies": { } },
"dnxcore50": { "dependencies": { } }
}
当我恢复包时,我收到此错误
NU1002项目WebApplication1中的依赖项ClassLibrary1 1.0.0不支持框架DNX,Version = v4.5.1。
我无法添加名称空间或任何内容。
然后我尝试了更明智的方法来实际定位net461
The program '[9328] dnx.exe' has exited with code 1 (0x1).
The program '[15060] iisexpress.exe' has exited with code -1 (0xffffffff).
从表面上看,这似乎是有效的,但它不会构建从ClassLibrary1引用的任何东西。
如果我删除了dnx框架,它将构建但是当我尝试调试它时它将无法工作。我收到此错误消息
"frameworks": {
"net461": { "dependencies": { "ClassLibrary1": "1.0.0-*" } },
"dnx451": {
"bin": {
"assembly": "../../ClassLibrary1/obj/{configuration}/ClassLibrary1.dll",
"pdb": "../../ClassLibrary1/obj/{configuration}/ClassLibrary1.pdb"
}
}
}
我甚至尝试了这一点,甚至到了硬编码的路径,但无济于事
{{1}}
有没有办法做到这一点?
我一定错过了什么......