我有dotnet restore命令的问题 我的项目有以下结构: `
MyApp
-__gitsubmodule/Lib-bus/project.json (target NetStandart1.6)
Programe.cs
project.json ( target NetCoreApp1.0 )
当我运行dotnet restore时,我有:
log : Restoring packages for /MyApp/__gitsubmodule/Lib-bus/project.json...
log : Restoring packages for /MyApp/project.json...
log : Lock file has not changed. Skipping lock file write. Path: MyApp/__gitsubmodule/Lib-bus/project.lock.json
log : MyApp/__gitsubmodule/Lib-bus/project.json
log : Restore completed in 715ms.
error: Unable to resolve 'Lib-bus (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
log : Lock file has not changed. Skipping lock file write. Path: /MyApp/project.lock.json
log : /MyApp/project.json
log : Restore failed in 974ms.
Errors in MyApp/project.json
Unable to resolve 'Lib-bus(>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
我认为dotnet无法正确找到Lib-bus。我找到了解决方案更改结构并添加了global.json,但它并不方便。也许你现在可以设置Lib-bus的路径了。感谢。
答案 0 :(得分:1)
你的project.json里有什么?
您是否使用OnConnected
引用了Lib-bus?
public class SignalRHub : Hub
{
private const string UserIdHeader = "SRUserId";
private readonly static SignalRInMemoryUserMapping Connections = new SignalRInMemoryUserMapping();
public override Task OnConnected()
{
if (string.IsNullOrEmpty(Context.Headers[UserIdHeader]))
{
// TODO: Somehow make sure SignalR DOES NOT connect this user!
return Task.FromResult(0);
}
Connections.Add(Context.Headers[UserIdHeader], Context.ConnectionId);
Debug.WriteLine("Client {0}-{1} - {2}", Context.Headers[UserIdHeader], Context.ConnectionId, "CONNECTED");
return base.OnConnected();
}
如果您不想使用global.json,如果您未指定target: "project"
,则将在Nuget上解析所有包。