ReSharper inspectcode.exe 2016.3抛出异常

Las*_*tio 3 .net c# resharper command-line

我已经下载了ReSharper的inspectcode.exe版本2016.3,但即使是"inspectcode.exe --help"也无法顺利运行并显示许多错误.

首先它打印"运行...",然后是五个例外,最后是帮助文本.

什么可以解决这个问题?使用9.1.1版本没有任何问题.

输出inspectcode.exe - help

PS C:\somefolder> .\inspectcode.exe --help
JetBrains Inspect Code 2016.3.1
Running in 64-bit mode, .NET runtime 4.0.30319.42000 under Microsoft Windows NT 6.2.9200.0
Component JetBrains.Application.SinceClr4.Extensions.JetPackageRepositoryFactoryEnvironmentComponent [Singleton, Corrupted] construction has failed. Could not bind a part catalog assembly "JetBrains.Platform.Shell.SinceClr4, Version=107.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325" by loading from file C:
\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll. Could not load file or assembly 'file:///C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515.) An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

--- EXCEPTION #1/5 [NotSupportedException]
Message = "An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information."
ExceptionPath = Root.InnerException.InnerException.InnerException.InnerException
ClassName = System.NotSupportedException
HResult = COR_E_NOTSUPPORTED=80131515

--- Outer ---

--- EXCEPTION #2/5 [FileLoadException]
Message = "Could not load file or assembly 'file:///C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
ExceptionPath = Root.InnerException.InnerException.InnerException
ClassName = System.IO.FileLoadException
InnerException = "Exception #1 at Root.InnerException.InnerException.InnerException.InnerException"
HResult = COR_E_NOTSUPPORTED=80131515
Source = mscorlib
FileLoad_FileName = file:///C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll
StackTraceString = "
  at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
     at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
     at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
     at System.Reflection.Assembly.LoadFrom(String assemblyFile)
     at JetBrains.Application.Bindings.AssemblyMasterBinderOnDiskFiles.JetBrains.Application.Bindings.IAssemblyMasterBinder.BindToRuntimeAssembly(AssemblyNameInfo name, OnError onerror)
"

--- Outer ---

--- EXCEPTION #3/5 [InvalidOperationException]
Message = "Could not bind a part catalog assembly "JetBrains.Platform.Shell.SinceClr4, Version=107.0.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325" by loading from file C:\inspectcodeFolder\JetBrains.Platform.Shell.SinceClr4.dll."
ExceptionPath = Root.InnerException.InnerException
ClassName = System.InvalidOperationException
InnerException = "Exception #2 at Root.InnerException.InnerException.InnerException"
HResult = COR_E_INVALIDOPERATION=80131509
Source = JetBrains.Platform.Util
StackTraceString = "
  at JetBrains.Util.OnError.<.cctor>b__18(Exception ex)
     at JetBrains.Application.Bindings.AssemblyMasterBinderOnDiskFiles.JetBrains.Application.Bindings.IAssemblyMasterBinder.BindToRuntimeAssembly(AssemblyNameInfo name, OnError onerror)
     at JetBrains.Application.Table.TablePartCatalogStorage.<>c__DisplayClass8.<.cctor>b__3(Int32`1 tk)
     at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     at JetBrains.Application.Table.TablePartCatalogStorage.TypeBind(Int32`1 token)
     at JetBrains.Application.Extensibility.PartCatalogTypeComponentDescriptor.CreateInstance(IValueResolveContext context)
     at JetBrains.Application.Components.SingletonDescriptor.CreateInstanceChecked(OnError onError, IComponentContainer container)
     at JetBrains.Application.Components.SingletonDescriptor.GetValue()
     at JetBrains.Application.Components.InitializationStrategyDefault.Schedule(Lifetime lifetime, ICollection`1 dscs)
"

--- Outer ---

--- EXCEPTION #4/5 [TargetInvocationException]
Message = "Component JetBrains.Application.SinceClr4.Extensions.JetPackageRepositoryFactoryEnvironmentComponent [Singleton, Corrupted] construction has failed."
ExceptionPath = Root.InnerException
ClassName = System.Reflection.TargetInvocationException
InnerException = "Exception #3 at Root.InnerException.InnerException"
HResult = COR_E_TARGETINVOCATION=80131604

--- Outer ---

--- EXCEPTION #5/5 [LoggerException]
Message = "Component JetBrains.Application.SinceClr4.Extensions.JetPackageRepositoryFactoryEnvironmentComponent [Singleton, Corrupted] construction has failed."
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
InnerException = "Exception #4 at Root.InnerException"
HResult = COR_E_APPLICATION=80131600
StackTraceString = "
  at JetBrains.Util.Logging.Logger.LogException(Exception ex)
     at JetBrains.Application.Components.InitializationStrategyDefault.Schedule(Lifetime lifetime, ICollection`1 dscs)
     at JetBrains.Application.Components.ComponentStorage.ComposeDescriptors(ICollection`1 descriptors)
     at JetBrains.Application.Components.ComponentStorage.Compose()
     at JetBrains.Application.Environment.JetEnvironment..ctor(Lifetime lifetime, JetHostParametersCaller host)
     at JetBrains.Application.Environment.JetEnvironment.<>c__DisplayClasse.<InternalCreate>b__b()
     at JetBrains.Threading.ReentrancyGuard.Execute(String name, Action action)
     at JetBrains.Application.Environment.JetEnvironment.InternalCreate(LifetimeDefinition lifetimeDefinition, JetHostParametersCaller host, JetEnvironment& environment)
     at JetBrains.Application.Environment.JetEnvironment.CreateAndRun(Full hostparams)
     at JetBrains.CommandLine.Common.Console.Application.CommandLineProgram.Main(Assembly assembly, Type environmentZoneType, HostInfo hostInfo, IProductInfo productInfo, String[] args)
     at JetBrains.CommandLine.Common.Console.Application.CommandLineProgram.<Run>b__1[TZone,TProductInfo](RunnerContext ctx)
"

Usage: InspectCode.exe [options] [project file]
Options:
  --config : Path to configuration file where parameters are specified (use 'config-create' option to create sample file).
  --config-create : Write command line parameters to specified file.
  --toolset : MsBuild toolset version. Highest available is used by default. Example: --toolset=12.0.
  --output (-o) : Write inspections report to specified file.
  --format (-f) : Write inspections report in specified format (Xml, Html, Txt).
  --absolute-paths (-a) :

Use absolute paths in inspections report (default: False).
  --no-swea : Force disable solution-wide analysis (default: False).
  --swea : Force enable solution-wide analysis (default: False).
  --project : Analyze only projects selected by provided wildcards (default: analyze all projects in solution).
  --profile (-p) : Path to the file to use custom settings from (default: Use R#'s solution shared settings if exists).
  --no-buildin-settings : Suppress global, solution and project settings profile usage. Alias for --disable-settings-layers:GlobalAll;GlobalPerProduct;SolutionShared;SolutionPersonal;ProjectShared;ProjectPersonal (default: False).
  --disable-settings-layers (-dsl) : Disable specified settings layers. Possible values: GlobalAll, GlobalPerProduct, SolutionShared, SolutionPersonal, ProjectShared, ProjectPersonal.
  --caches-home : Path to the directory where produced caches will be stored.
  --debug (-d) : Show debugging messages (default: False).
  --help (-h) : Show help and exit.
  --version (-v) : Show tool version and exit.
  --eXtensions (-x) : Install and use specified extensions.
  --properties : MSBuild properties.
  --targets-for-references : MSBuild targets. These targets will be executed to get referenced assemblies of projects..
  --targets-for-items : MSBuild targets. These targets will be executed to get other items (e.g. Compile item) of projects..
  --dumpIssuesTypes (-it) : Dump issues types (default: False).
Example:
  InspectCode.exe --caches-home="C:\Temp\Cache" -o="report.xml" "C:\src\MySolution.sln"
Run Code Online (Sandbox Code Playgroud)

Ale*_*kin 6

按照本文中提到的步骤操作

问题:你看到很多例外:

--- EXCEPTION#1/4 [NotSupportedException] Message ="尝试从网络位置加载程序集,这会导致程序集在以前版本的.NET Framework中被沙箱化.此版本的.NET框架没有通过def ault启用CAS策略,因此这种负载可能是危险的.如果此负载不是沙盒程序集,请启用loadFromRemoteSources开关.请参阅 http://go.microsoft.com/fwlink/?LinkId= 155569了解更多信息." ExceptionPath = Root.InnerException.InnerException.InnerException ClassName = System.NotSupportedException HResult = COR_E_NOTSUPPORTED = 80131515

解:

  1. 打开从JetBrains网站下载的"zip"文件的"属性"窗口;
  2. 选择"常规"选项卡;
  3. 点击"解锁";
  4. 再次从存档中提取文件;