Skip to content

Commit

Permalink
Update instructions related neo.smartcontract.framework and change …
Browse files Browse the repository at this point in the history
…the sample contract to the HelloWorld example (neo-project#485)
  • Loading branch information
ixje authored and Celia18305 committed May 2, 2018
1 parent 849bc19 commit 44fedd1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
Binary file modified assets/mac5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 18 additions & 11 deletions en-us/sc/quickstart/getting-started-csharp-mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,38 @@ Just check the basic functions when installing, without selecting the platform s

![](../../../assets/mac3.png)

### 2. Building NEO smartcontract framework
Unlike on Windows where they can get the `Neo.Smartcontract.Framework` via `NuGet`, on OSX we have to compile it ourselves or step 6 (see below) will fail when using any of the NEO smartcontract specific methods.

### 2. New Project
Download [neo-devpack-dotnet](https://github.com/neo-project/neo-devpack-dotnet) from GitHub. Open `neo-devpack-dotnet.sln`. You might receive errors about "Unknown solution item type" for the Installer and 2 Template projects, these can be safely ignored. Dismiss the warning dialog and right click on the `Neo.Smartcontract.Framework` project, choose `Build`. Note the location where the `Neo.Smartcontract.Framework.dll` is saved, we will need this location in the next step. i.e.
```
<neo-devpack-dotnet download folder>/bin/Debug/netstandard2.0/Neo.SmartContract.Framework.dll.
```

### 3. New Project

Open Visual Studio for Mac,create a new project, and select .NET Standard Library(.NET Core → Library)。

![](../../../assets/mac4.png)

> [!Note]
> When you create a new project, select 2.0 for the .NET Core version,because if you select 1.x ,then adding “Neo.SmartContract.Framework” will fail.
> When you create a new project, select 2.0 for the .NET Core version.
Next, right click on the project,click `Add NuGet Packages...`,search for “neo”,select “Neo.SmartContract.Framework”,and click on `Add Package`
Next, expand the project,right click on `Dependencies` and choose `Edit references...`. Go to the `.NET Assembly` tab, choose `Browse` and add the `Neo.Smartcontract.Framework.dll` from the location saved in Step 2.

![](../../../assets/mac5.png)

After the installation is successful, write the following sample code in your Class1.cs file.
Check the checkbox and press ok to close the dialog. Next, write the following sample code in your Class1.cs file.

```c#
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Services.Neo;

public class Class1: SmartContract
{
public static bool Main()
public static void Main()
{
return true;
Storage.Put(Storage.CurrentContext, "Hello", "World");
}
}
```
Expand All @@ -45,7 +52,7 @@ In the menu choose `Build`,`Build All` to compile the corresponding code. A .d

In the example the contract is named `sample_contract`. After compilation the file `sample_contract.dll` is created that we'll use in the next section.

### 3. neo-compiler
### 4. neo-compiler

Download [neo-compiler](https://github.com/neo-project/neo-compiler) from GitHub. Before opening the solution in Visual studio we first have to edit the `neon.csproj` to alter the runtime identifiers. Locate the file at `/neo-compiler/neon/neon.csproj`, open it using a text editor and replace
```
Expand All @@ -58,14 +65,14 @@ with
Next open the `neo-compiler` solution and build the project. You'll now find `neon.dll` under `/bin/Debug/netcoreapp2.0/`.


### 4. .NET Core
### 5. .NET Core

Download and install [.NET Core 2.0.3](https://www.microsoft.com/net/download/macos) if you haven't already done so.

![](../assets/mac8.png)


### 5. Compiling your smart contract to .avm
### 6. Compiling your smart contract to .avm

The basic syntax is

Expand All @@ -77,8 +84,8 @@ dotnet neon.dll <your smart contract.dll>

```bash
Eriks-Air:netcoreapp2.0 erik$ dotnet neon.dll ~/Projects/sample_contract/sample_contract/bin/Debug/netstandard2.0/sample_contract.dll
Neo.Compiler.MSIL console app v2.0.3.1
Find entrypoint:System.Boolean Class1::Main()
Neo.Compiler.MSIL console app v2.0.3.5
Find entrypoint:System.Void Class1::Main()
convert succ
gen abi succ
write:sample_contract.avm
Expand Down

0 comments on commit 44fedd1

Please sign in to comment.