MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.88k stars 847 forks source link

No extension for Visual Studio Code #220

Closed decadeofdata closed 7 years ago

decadeofdata commented 7 years ago

Visual Studio doesnt work on Linux. Visual studio code has no extension called NBitcoin.

MonoDevelop doesnt work either.

Any ideas for an IDE that works for LinuxMint earlier than Ubuntu 16?

NicolasDorier commented 7 years ago

What do you want to do?

If you want to use NBitcoin, reference the package through Nuget, it works on all platform.

For development with Visual Studio Code; Try to open "E\NBitcoin.NETCore\project.json". Not entirely sure it will works fine though. Xamarin/Mono Develop should be able to open the NBitcoin.csproj normally.

decadeofdata commented 7 years ago

I am trying to follow programming blockchain with c# https://programmingblockchain.gitbooks.io/programmingblockchain/content/introduction/project_setup.html

With Visual Code, there is no "new project" option.

when i opened that project.json, it seems to install a project.lock.json file in the folder NBitcoin.NETCore.

i dont know how to start a new project, do I just make a new folder and copy and paste the project.json over?

Mono Develop doesnt open.

If I eventually find a solution, I will edit the book to include it.

DemonRx commented 7 years ago

@ResponsiveWebApps Give them a try:

https://www.jetbrains.com/rider/

Also for linux have dotnet installed as instructed in this guide: https://www.microsoft.com/net/core#linuxubuntu

decadeofdata commented 7 years ago

@D3m0nKingx

Installed Rider. Now how do I install NBitcoin on it?

DemonRx commented 7 years ago

Open the project file within Rider: NBitcoin/NBitcoin.NETCore/project.json

I did get an error after loading, which has already been reported: https://youtrack.jetbrains.com/issue/RIDER-3818

Otherwise the project loads and builds:

Project NBitcoin (.NETStandard,Version=v1.3) will be compiled because expected outputs are missing
Compiling NBitcoin for .NETStandard,Version=v1.3
Compilation succeeded.
    0 Warning(s)
    0 Error(s)
Time elapsed 00:00:14.6851235

Project NBitcoin (.NETStandard,Version=v1.1) will be compiled because expected outputs are missing
Compiling NBitcoin for .NETStandard,Version=v1.1
Compilation succeeded.
    0 Warning(s)
    0 Error(s)
Time elapsed 00:00:12.2611671

Build succeeded at 13:56:04
NicolasDorier commented 7 years ago

wait I think @ResponsiveWebApps do not want to build NBitcoin, just to use it in .NET Core.

If that is the case, please take a look at https://channel9.msdn.com/Blogs/dotnet/Get-started-with-VS-Code-using-CSharp-and-NET-Core

Also https://www.microsoft.com/net/core#linuxubuntu might help.

If you want to add NBitcoin reference to your project, you need to add dependency in your own project.json to "NBitcoin".

I should probably update the book for using NBitcoin with .NET Core.

knocte commented 7 years ago

Now how do I install NBitcoin on it?

@ResponsiveWebApps there's a fundamental difference between a library and an IDE extension. You don't install libraries on IDEs. You install libraries in the solutions/projects that you manage, with your IDE.

Example of libraries: CsvHelper is a library that lets you parse CSV. NewtonsoftJson is a library that lets you parse JSON. NBitcoin is a library that lets you create bitcoin transactions and keys.

Example of an IDE extension: The Nuget features of Visual Studio are an extension. The git capabilities of MonoDevelop are an extension. The NUnit support in Rider is (probably*) an extension.

* Never used Rider, not 100% sure about this.

decadeofdata commented 7 years ago

@NicolasDorier I dig that video. Thanks.

{ "version": "1.0.0-*", "buildOptions": { "debugType": "portable", "emitEntryPoint": true }, "dependencies": {}, "frameworks": { "netcoreapp1.1": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.1.0" } }, "imports": "dnxcore50" } } }

Following that Hello world example, how do I add the dependency for NBitcoin?

*This is my first time using c#.

decadeofdata commented 7 years ago

"dependencies": { "NBitcoin":"1.0.0.0" },

Like this?

Running gets me the error.

log : Installing NBitcoin 1.0.0. error: Package NBitcoin 1.0.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package NBitcoin 1.0.0 supports: net45 (.NETFramework,Version=v4.5) error: Package BouncyCastle 1.7.0 is not compatible with netcoreapp1.1 (.NETCoreApp,Version=v1.1). Package BouncyCastle 1.7.0 supports: error: - net20 (.NETFramework,Version=v2.0) error: - net40-client (.NETFramework,Version=v4.0,Profile=Client) error: One or more packages are incompatible with .NETCoreApp,Version=v1.1.

decadeofdata commented 7 years ago

@D3m0nKingx I dont "references" as an option in Rider.

NicolasDorier commented 7 years ago

referecen version "*", not 1.0.0.0. I don t know what is rider.

decadeofdata commented 7 years ago

Done: 0.

so far so good.

decadeofdata commented 7 years ago

The type or namespace name 'Key' could not be found (are you missing a using directive or an assembly reference?)

I have no idea if I am following the instructions right.

`using System;

namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Key privateKey = new Key(); // generate a random private key Console.Write(Key); } } } `

decadeofdata commented 7 years ago

I still get these errors, but something gets written into the console. So maybe I can get through the book.

Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/1.1.0/System.Text.Encoding.dll'. Cannot find or open the symbol file. Loaded '/usr/share/dotnet/shared/Microsoft.NETCore.App/1.1.0/System.Threading.Tasks.dll'. Cannot find or open the symbol file. NBitcoin.Key Loaded '/home/responsive/.nuget/packages/System.Collections.NonGeneric/4.0.1/lib/netstandard1.3/System.Collections.NonGeneric.dll'. Cannot find or open the symbol file. 02953a5f8d7f65c71a8341aaeeabbe5bd038fa5bc5611072baa265b994d65adae6 The program '/home/responsive/Sandbox/Blockchain/HelloWorld/bin/Debug/netcoreapp1.1/HelloWorld.dll' has exited with code 0 (0x00000000).

NicolasDorier commented 7 years ago

your code is running or it would not show NBitcoin.Key. You can continue the rest of the book.

decadeofdata commented 7 years ago

@NicolasDorier yes thanks. i have completed some of the exercises. I enjoy the language in it. Especially the Fountain Head quote. :-)