检索Visual Studio 2017在线项目模板失败,其中包含"' baseName'不能是空字符串("")或以空字符开头"

时间:2018-02-08 11:15:36

标签: visual-studio-2017

重现:

在Visual Studio 2017中,xUnit测试项目:

  

右键单击Project,选择Add - >新项目...选择'在线'

错误对话框:

Retrieving Visual Studio 2017 online item templates fails with "'baseName' cannot be an empty string ("") or start with null character"

参数名称:baseName

Log:

=====================
08/02/2018 10:36:14
Recoverable
System.ArgumentException: 'baseName' cannot be an empty string ("") or start with the null character.
Parameter name: baseName
   at Microsoft.Requires.NotNullOrEmpty(String value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.SimpleHierarchyNode.<GenerateUniqueItemNameAsync>d__80.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass460_0.<<GenerateUniqueItemName>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously(Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass548_0.<HrInvoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.<>c__DisplayClass36_0.<Invoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(Func`1 action, IServiceProvider vsShellServiceProvider, IProjectFaultHandlerService projectFaultHandlerService, UnconfiguredProject project)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
===================
08/02/2018 10:43:30
Recoverable
System.ArgumentException: 'baseName' cannot be an empty string ("") or start with the null character.
Parameter name: baseName
   at Microsoft.Requires.NotNullOrEmpty(String value, String parameterName)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.SimpleHierarchyNode.<GenerateUniqueItemNameAsync>d__80.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass460_0.<<GenerateUniqueItemName>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
   at Microsoft.VisualStudio.ProjectSystem.ProjectMultiThreadedService.ExecuteSynchronously(Func`1 asyncAction)
   at Microsoft.VisualStudio.ProjectSystem.VS.Implementation.Package.ProjectNode.<>c__DisplayClass548_0.<HrInvoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.<>c__DisplayClass36_0.<Invoke>b__0()
   at Microsoft.VisualStudio.ProjectSystem.VS.HResult.Invoke(Func`1 action, IServiceProvider vsShellServiceProvider, IProjectFaultHandlerService projectFaultHandlerService, UnconfiguredProject project)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.ProjectSystem.CommonProjectSystemTools.Rethrow(Exception ex)
   at Microsoft.VisualStudio.ProjectSystem.ProjectErrorReporting.<>c__DisplayClass6_0.<SubmitErrorReport>b__0()
   at Microsoft.VisualStudio.ProjectSystem.ExceptionFilter.<>c__DisplayClass2_0.<Guard>b__0()
   at GuardMethodClass.GuardMethod(Func`1 , Func`2 , Func`2 )
===================

尝试:

answer中的解决方案(类似消息,原因不同):

Clearing NuGet cache, restarting

我无法在任何地方找到有关此特定症状的信息。我对VS和一般的.NET都很新,因此日志中可能会有一些我不理解的有用信息。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题。不幸的是,这似乎是微软必须解决的问题。在以下网址中,它表示已解决该问题,并将在下次更新中包含此修复程序:https://developercommunity.visualstudio.com/content/problem/192168/add-new-file-online-template-basename-empty-string.html

目前Patrick提到的解决方法,从另一个项目中添加,将是您最好的选择。