lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] NightOwl888 commented on issue #453: Code snippets on https://lucenenet.apache.org/ doesn't works.
Date Fri, 26 Mar 2021 16:46:12 GMT

NightOwl888 commented on issue #453:
URL: https://github.com/apache/lucenenet/issues/453#issuecomment-808365018


   Thanks for the additional report. I have confirmed the behavior and discovered this has
been failing since 4.8.0-beta00009.
   
   ```
   F:\Projects\lucenenet>dotnet tool install lucene-cli -g --version 4.8.0-beta00013
   You can invoke the tool using the following command: lucene
   Tool 'lucene-cli' (version '4.8.0-beta00013') was successfully installed.
   
   F:\Projects\lucenenet>lucene
   Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json'
was not found and is not optional. The physical path is 'C:\Users\shad\.dotnet\tools\.store\lucene-cli\4.8.0-beta00013\lucene-cli\4.8.0-beta00013\tools\netcoreapp3.1\any\appsettings.json'.
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at Lucene.Net.Cli.Program.Main(String[] args) in D:\a\1\s\src\dotnet\tools\lucene-cli\Program.cs:line
27
   
   F:\Projects\lucenenet>dotnet tool uninstall lucene-cli -g
   Tool 'lucene-cli' (version '4.8.0-beta00013') was successfully uninstalled.
   
   F:\Projects\lucenenet>dotnet tool install lucene-cli -g --version 4.8.0-beta00012
   You can invoke the tool using the following command: lucene
   Tool 'lucene-cli' (version '4.8.0-beta00012') was successfully installed.
   
   F:\Projects\lucenenet>lucene
   Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json'
was not found and is not optional. The physical path is 'C:\Users\shad\.dotnet\tools\.store\lucene-cli\4.8.0-beta00012\lucene-cli\4.8.0-beta00012\tools\netcoreapp3.1\any\appsettings.json'.
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo
info)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at Lucene.Net.Cli.Program.Main(String[] args) in D:\a\1\s\src\dotnet\tools\lucene-cli\Program.cs:line
27
   
   F:\Projects\lucenenet>dotnet tool uninstall lucene-cli -g
   Tool 'lucene-cli' (version '4.8.0-beta00012') was successfully uninstalled.
   
   F:\Projects\lucenenet>dotnet tool install lucene-cli -g --version 4.8.0-beta00011
   You can invoke the tool using the following command: lucene
   Tool 'lucene-cli' (version '4.8.0-beta00011') was successfully installed.
   
   F:\Projects\lucenenet>lucene
   Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json'
was not found and is not optional. The physical path is 'C:\Users\shad\.dotnet\tools\.store\lucene-cli\4.8.0-beta00011\lucene-cli\4.8.0-beta00011\tools\netcoreapp3.1\any\appsettings.json'.
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo
info)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at Lucene.Net.Cli.Program.Main(String[] args) in D:\a\1\s\src\dotnet\tools\lucene-cli\Program.cs:line
27
   
   F:\Projects\lucenenet>
   F:\Projects\lucenenet>dotnet tool uninstall lucene-cli -g
   Tool 'lucene-cli' (version '4.8.0-beta00011') was successfully uninstalled.
   
   F:\Projects\lucenenet>dotnet tool install lucene-cli -g --version 4.8.0-beta00010
   You can invoke the tool using the following command: lucene
   Tool 'lucene-cli' (version '4.8.0-beta00010') was successfully installed.
   
   F:\Projects\lucenenet>lucene
   Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json'
was not found and is not optional. The physical path is 'C:\Users\shad\.dotnet\tools\.store\lucene-cli\4.8.0-beta00010\lucene-cli\4.8.0-beta00010\tools\netcoreapp3.1\any\appsettings.json'.
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo
info)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at Lucene.Net.Cli.Program.Main(String[] args) in D:\a\1\s\src\dotnet\tools\lucene-cli\Program.cs:line
27
   
   F:\Projects\lucenenet>dotnet tool uninstall lucene-cli -g
   Tool 'lucene-cli' (version '4.8.0-beta00010') was successfully uninstalled.
   
   F:\Projects\lucenenet>dotnet tool install lucene-cli -g --version 4.8.0-beta00009
   You can invoke the tool using the following command: lucene
   Tool 'lucene-cli' (version '4.8.0-beta00009') was successfully installed.
   
   F:\Projects\lucenenet>lucene
   Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json'
was not found and is not optional. The physical path is 'C:\Users\shad\.dotnet\tools\.store\lucene-cli\4.8.0-beta00009\lucene-cli\4.8.0-beta00009\tools\netcoreapp3.1\any\appsettings.json'.
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo
info)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at Lucene.Net.Cli.Program.Main(String[] args) in D:\a\1\s\src\dotnet\tools\lucene-cli\Program.cs:line
27
   
   F:\Projects\lucenenet>dotnet tool uninstall lucene-cli -g
   Tool 'lucene-cli' (version '4.8.0-beta00009') was successfully uninstalled.
   
   F:\Projects\lucenenet>dotnet tool install lucene-cli -g --version 4.8.0-beta00008
   You can invoke the tool using the following command: lucene
   Tool 'lucene-cli' (version '4.8.0-beta00008') was successfully installed.
   
   F:\Projects\lucenenet>lucene
    Lucene.Net Command Line Utility, Version: 4.8.0-beta00008 commit:[c63b8834c6]
   
   Usage:  [command]
   
   Commands:
     analysis   Utilities to manage specialized analyzers.
     benchmark  Utilities for benchmarking Lucene.Net.
     demo       Demos for various Lucene.Net functionality including C# code samples.
     index      Utilities to analyze or maintain an index.
     lock       Utilities for verifying concurrent locking integrity.
   
   Use " [command] --help" for more information about a command.
   
   
   F:\Projects\lucenenet>
   ```
   
   It seems that when the `Microsoft.Extensions.Configuration` features were added, the default
option of requiring an `appsettings.json` file was chosen instead of allowing it to be optional.
   
   I am considering just supplying a `appsettings.json` file with all of the default settings
to make it clearer which settings are available in `lucene-cli` until we have documentation
(see #307). But even with a default file, it should still be made optional.
   
   In addition, it is clear we need some basic smoke tests to ensure that the tool will install
and run without throwing exceptions.
   
   In the meantime, you can work around this problem by manually adding an empty JSON file
named `appsettings.json` to the appropriate directory on your system. 
   
   #### appsettings.json
   ```json
   {
   }
   ```
   
   > **IMPORTANT**: There must be at least opening and closing curly brackets in the file,
or it won't be parsed as valid JSON.
   
   The location it is looking for the file on your system in is in the error message:
   
   ```
   The physical path is 'C:\Users\Kuinox\.dotnet\tools\.store\lucene-cli\4.8.0-beta00013\lucene-cli\4.8.0-beta00013\tools\netcoreapp3.1\any\appsettings.json'.
   ```
   
   But if you need more help locating where the tool is located, see [How to manage .NET tools](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools).
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message