Resharper命令行检查会抛出异常

时间:2015-01-09 06:55:45

标签: command-line resharper teamcity code-inspection

我们使用TeamCity作为CI服务器,并希望激活代码检查(.Net)。如果我配置代码检查,我从检查员那里得到了很多错误。如果我尝试使用resharper comman line tools进行代码检查,那就相同。

我们有以下项目/解决方案结构

/
- Solutions/
    - Solution1/
        - Solution1.sln
        - BuildOutput/
    - Solution2/
        - Solution2.sln
        - BuildOutput
    ...
- Projects/
    - Project1/
        ...
    - Project2/
        ...

项目被配置为始终构建在解决方案BuildOutput目录中。

如果我从解决方案目录执行这样的代码检查:

C:\Tools\RSCL\inspectcode.exe "Solution1.sln"

我在命令行上输出了以下错误:

JetBrains Inspect Code 9.0 Update 1 
Running in 64-bit mode, .NET runtime 4.0.30319.34014 under Microsoft Windows NT 6.2.9200.0
C:\Tools\RSCL\inspectcode.exe : Paths relative to drive roots are not supported. Parametername: component Der tats„chliche Wert war \BuildOutput\Debug.
In Zeile:1 Zeichen:1
+ C:\Tools\RSCL\inspectcode.exe "Solution1.sln"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Paths relative ...ldOutput\Debug.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

--- EXCEPTION #1/2 [ArgumentOutOfRangeException]
Message = "Paths relative to drive roots are not supported."
ExceptionPath = Root.InnerException
ClassName = System.ArgumentOutOfRangeException
HResult = COR_E_ARGUMENTOUTOFRANGE=80131502
Source = JetBrains.Platform.Util
ParamName = component
ActualValue = \BuildOutput\Debug
StackTraceString = "
  bei JetBrains.Util.FileSystemPath.Combine(String component)
     bei JetBrains.ProjectModel.Impl.CachedProjectItemValue`2.GetValue()
     bei JetBrains.ProjectModel.ProjectImpl.<.ctor>b__5(ProjectImpl element)
     bei JetBrains.ProjectModel.ProjectImpl.GetOutputFilePath()
     bei JetBrains.ProjectModel.Build.OutputAssemblies.UpdateOutputAssemblyMvid(IProject project)
     bei JetBrains.ProjectModel.Build.OutputAssemblies.AfterProjectOpenedInternal(IProject project)
     bei JetBrains.DataFlow.Viewable.<>c__DisplayClass1d`1.<View>b__1b(Lifetime valueLifetime, TValue value)
     bei JetBrains.DataFlow.ViewableCollection`1.Add(TValue item)
     bei JetBrains.DataFlow.Lifetime.AddBracket(Action FOpening, Action FClosing)
     bei JetBrains.ProjectModel.ProjectManagerBase.OpenProjectInstance(Pair`2 projectInstanceWithLifetime)
     bei JetBrains.ProjectModel.ProjectManagerBase.<>c__DisplayClass8.<EnqueueOpenProjectInstance>b__6()
     bei JetBrains.Util.Logging.Logger.Catch(Action action)
"
--- Outer ---
--- EXCEPTION #2/2 [LoggerException]
Message = "
  Paths relative to drive roots are not supported.
  Parametername: component
  Der tats„chliche Wert war \BuildOutput\Debug.
"
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = "Exception #1 at Root.InnerException"
HResult = COR_E_APPLICATION=80131600
StackTraceString = "
  bei JetBrains.ProjectModel.Tasks.SolutionLoadTasksSchedulerBase.ExecuteOneTask(SolutionLoadTask task)
     bei JetBrains.ProjectModel.Tasks.SolutionLoadTasksSchedulerBase.DispatchTasks(Boolean background)
     bei JetBrains.ProjectModel.SolutionManagerBase.CreateSolutionInstance(SolutionElement solutionElement, SolutionInstance solutionInstance)
     bei JetBrains.ProjectModel.MsBuild.Internal.MsBuildSolutionManager.<>c__DisplayClass4.<>c__DisplayClass6.<.ctor>b__1()
     bei JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)
     bei JetBrains.Threading.ReentrancyGuard.ExecuteOrQueue(String name, Action action)
     bei JetBrains.ProjectModel.MsBuild.Internal.MsBuildSolutionManager.<>c__DisplayClass4.<.ctor>b__0(Lifetime msBuildSolutionLifetime, MsBuildSolution msBuildSolution)
     bei JetBrains.DataFlow.Lifetimes.Define(Lifetime lifetime, String id, Action`2 FAtomic, ILogger logger)
     bei JetBrains.DataFlow.SequentialLifetimes.DefineNext(Action`2 FNext)
     bei JetBrains.DataFlow.Signal`1.NotifySinks(TValue payload)
     bei JetBrains.DataFlow.Signal`1.Fire(TValue value, Object cookie)
     bei JetBrains.DataFlow.Property`1.FireChange(TValue old, TValue new, Object cookie)
     bei JetBrains.DataFlow.Property`1.SetValue(TValue value, Object cookie)
     bei JetBrains.ProjectModel.MsBuild.MsBuildSolutionHost.OpenSolution(FileSystemPath location, IMsBuildSolutionUserProfile userProfile)
     bei JetBrains.CommandLine.InspectCode.Unattended.InspectCodeProductMain.OpenSolution(FileSystemPath solutionFilePath, ILogger logger, MsBuildSolutionHost solutionHost, SolutionsManager solutionsManager, 
IInspectCodeSettings settings)
     bei JetBrains.CommandLine.InspectCode.Unattended.InspectCodeProductMain.Main(IThreading invocator, IShellLocks shellLocks, ILogger logger, IInspectCodeSettings settings, MsBuildSolutionHost solutionHost, 
SolutionsManager solutionsManager, PlatformMana
ger platformManager, ISdkManager sdkManager, IProductCommandLineArguments argumentsRaw, IssuesTypesWriter issuesTypesWriter)
     bei System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
     bei System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
     bei System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
     bei JetBrains.Application.Environment.RunsPublicStaticIntMain.<>c__DisplayClass7.<.ctor>b__0()
     bei JetBrains.Util.Logging.Logger.Catch(Action action)
     bei JetBrains.Threading.JetDispatcher.Closure.Execute()
     bei JetBrains.Threading.JetDispatcher.ProcessQueue()
     bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
     bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
     bei System.Windows.Threading.DispatcherOperation.InvokeImpl()
     bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
     bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
     bei System.Windows.Threading.DispatcherOperation.Invoke()
     bei System.Windows.Threading.Dispatcher.ProcessQueue()
     bei System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     bei MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
     bei MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
     bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
     bei MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
     bei System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
     bei MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
     bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
     bei MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
     bei System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
     bei JetBrains.DataFlow.Lifetimes.Using(Action`1 ?)
     bei JetBrains.Application.Environment.IJetHostEx.RunHostMessageLoop(IComponentContainer containerEnv)
     bei JetBrains.Application.Environment.HostParameters.JetHostParametersCaller.RunMainLoop(ComponentContainer containerEnv)
     bei JetBrains.Application.Environment.JetEnvironment.InternalRun(JetHostParametersCaller host, ComponentContainer containerEnv)
     bei JetBrains.Application.Environment.JetEnvironment.CreateAndRun(Full hostparams)
     bei JetBrains.CommandLine.InspectCode.InspectCodeProgram.Main(Assembly assembly, HostInfo hostInfo, String[] args)
     bei JetBrains.CommandLine.InspectCode.InspectCodeProgram.Main(String[] args)
"
Paths relative to drive roots are not supported. Parametername: component Der tats„chliche Wert war \BuildOutput\Debug.
--- EXCEPTION #1/2 [ArgumentOutOfRangeException]

...

我不明白出了什么问题。解决方案都是可构建的,VS的代码检查在相同的解决方案上运行良好。

1 个答案:

答案 0 :(得分:1)

我明白了。我失败了,因为我的.csproj没有定义SolutionDir。相对路径错误可以说是红鲱鱼。

确保这是在csproj

<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>