Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run the code : New to C# and .net #44

Open
aashish-amber-abz opened this issue Sep 7, 2018 · 4 comments
Open

Unable to run the code : New to C# and .net #44

aashish-amber-abz opened this issue Sep 7, 2018 · 4 comments

Comments

@aashish-amber-abz
Copy link

This question might sound very basic/stupid but I am very new to c# and. net , I installed VS code and opened the downloaded symspell project code in it. Now how can i run the demo ?

In problems it shows the error:- The type 'List<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. [SymSpell.Test]

When i try to run the SegmentationDemo by ctr+f5 it gives error :-

Unhandled Exception: System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.ConsolePal.set_WindowWidth(Int32 value)
at symspell.Benchmark.Benchmark.Main(String[] args) in /Users/aashishamber/Downloads/SymSpell-master/SymSpell.Benchmark/SymSpell.Benchmark.cs:line 52

Kindly help how to run the code.

@aashish-amber-abz
Copy link
Author

/usr/local/share/dotnet/sdk/2.1.401/Microsoft.Common.CurrentVersion.targets(1179,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v4.6.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend. [/Users/aashishamber/Downloads/SymSpell-master/SymSpell/SymSpell.csproj]

@wolfgarbe
Copy link
Owner

  1. On which Operating System you are testing? If anything other than Windows try to comment out the lines 53...55 (Console resize is probably not supported on your platform):
    /*
    Console.WindowWidth = Math.Min(160, Console.LargestWindowWidth);
    Console.WindowHeight = Math.Min(80, Console.LargestWindowHeight);
    Console.BufferWidth = 800;
    Console.BufferHeight = 10000;
    */

  2. Make sure you have the latest version of the .NET SDK installed: https://www.microsoft.com/net/download

  3. Type "dotnet restore" in the terminal window of Visual Studio Code before first build

@aashish-amber-abz
Copy link
Author

aashish-amber-abz commented Sep 7, 2018

i am on mac os 10.13.6

dot net info installed are :-

.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.13-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.401/

Host (useful for support):
Version: 2.1.3
Commit: 124038c13e

.NET Core SDKs installed:
2.1.401 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

I changed net461

in SymSpell/SymSpell.Test/SymSpell.Test.csproj to

netstandard2.0

and commented out the piece of code you suggested and is running code by pressing ctrl+f5 in visual studio code but is still getting this error in debug console

Unhandled Exception: System.InvalidOperationException: Cannot read keys when either application does not have a console or when console input has been redirected. Try Console.Read.
at System.ConsolePal.ReadKey(Boolean intercept)
at symspell.Benchmark.Benchmark.Main(String[] args) in /Volumes/aashish_data/cg/AutoCorrect/SymSpell-master/SymSpell.Benchmark/SymSpell.Benchmark.cs:line 63

Also the Output tab in visual studio code has this error :-

Package 'NUnit3TestAdapter 3.10.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.
/Volumes/aashish_data/cg/AutoCorrect/SymSpell-master/SymSpell.Test/SymSpell.Test.csproj
/Volumes/aashish_data/cg/AutoCorrect/SymSpell-master/SymSpell.Test/SymSpell.Test.csproj(0,0): Error: Package 'NUnit3TestAdapter 3.10.0' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.

Kindly help.

@hanabi1224
Copy link
Contributor

Just created a PR to fix test & build on linux & osx: #81

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants