Skip to content

Commit

Permalink
Fix issues (neo-project#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
Celia18305 authored Apr 25, 2018
1 parent 55bc52c commit 7a65ade
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 78 deletions.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
11 changes: 6 additions & 5 deletions en-us/sc/quickstart/getting-started-csharp-mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ If you already have Visual Studio for Mac installed on your computer, skip this

Just check the basic functions when installing, without selecting the platform specific components.

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

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

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


### 2. New Project

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

![](../assets/mac4.png)
![](../../../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.
Next, right click on the project,click `Add NuGet Packages...`,search for “neo”,select “Neo.SmartContract.Framework”,and click on `Add Package`

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

After the installation is successful, write the following sample code in your Class1.cs file.

Expand Down Expand Up @@ -73,7 +73,8 @@ The basic syntax is
dotnet neon.dll <your smart contract.dll>
```

Note: `neon.dll` is the file from Step 3. In our example `sample_contract.dll` would be our smart contract. The output should look like this
`neon.dll` is the file from Step 3. In our example `sample_contract.dll` would be our smart contract. The output should look like this

```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
Expand Down
60 changes: 30 additions & 30 deletions en-us/sc/quickstart/getting-started-csharp-ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,54 @@

To develop smart contracts in C# on ubuntu, basically you need to do the following:

1. Create a library project, write code, and add the smart contract library.
2. Execute neo-compiler/neon to generate the compiler.
3. Run neon to generate the .avm file.
1. Create a library project, write code, and add the smart contract library.
2. Execute `neo-compiler/neon` to generate the compiler.
3. Run `neon` to generate the .avm file.

## Create a smart contract project

1. In the dotnet command line, create a library project:

```
mkdir NeoContractDemo
cd ./NeoContractDemo/
dotnet new library
rm ./Class1.cs
vim NeoContractDemo.cs
```
```c#
mkdir NeoContractDemo
cd ./NeoContractDemo/
dotnet new library
rm ./Class1.cs
vim NeoContractDemo.cs
```

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

2. In NeoContractDemo.cs, enter the following code and then press `ESC`+`wq!` .

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

public class NeoContractDemo: SmartContract
{
public static bool Main()
{
return true;
}
}
```
public class NeoContractDemo: SmartContract
{
public static bool Main()
{
return true;
}
}
```

3. Add the smart contract reference:

```
dotnet add package Neo.SmartContract.Framework --version 2.5.4
```
```
dotnet add package Neo.SmartContract.Framework --version 2.5.4
```

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

4. Compile the smart contract project:

```
dotnet publish -o ../testlib
```
```
dotnet publish -o ../testlib
```

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

## Generate the compiler

Expand Down
18 changes: 9 additions & 9 deletions en-us/sc/quickstart/getting-started-csharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ Download and install:

The installation process is very simple, just follow the operation prompts step-by-step. It should be noted that you need to check the installation of `.NET Core cross-platform development`, otherwise you will not be able to open neo-vm project in step #3. The installation takes about ten minutes or up to an hour.

![install net core cross-platform development toolset](../assets/install_core_cross_platform_development_toolset.png)
![install net core cross-platform development toolset](../../../assets/install_core_cross_platform_development_toolset.png)

### 2. NeoContractPlugin

Installation method:

Open Visual Studio 2017, open Tools, click on Extensions and Updates, click on the Online tab on the left side of the window, search NEO in the search box on the top right corner of the window, download the NeoContractPlugin (this step requires internet access).

![download and install NEO smart contract plugin](../assets/download_and_install_smart_contract_plugin.png)
![download and install NEO smart contract plugin](../../../assets/download_and_install_smart_contract_plugin.png)

### 3. neo-compiler

Installation and configuration steps:

Download the [neo-compiler](https://github.com/neo-project/neo-compiler) project on Github, open the solution with Visual Studio 2017, and publish the neon project

![publish NEO compiler msil project](../assets/publish_neo_compiler_msil_project.png)
![publish NEO compiler msil project](../../../assets/publish_neo_compiler_msil_project.png)

![publish and profile settings](../assets/publish_and_profile_settings.png)
![publish and profile settings](../../../assets/publish_and_profile_settings.png)

> [!Note]
>
Expand All @@ -66,11 +66,11 @@ We now need to add this directory to our execution path. The PATH is the system
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

![edit environmental variables](../assets/edit_environmental_variables.png)
![edit environmental variables](../../../assets/edit_environmental_variables.png)

Now run Command or PowerShell, and enter neon.exe. If there is no error and the output shows the version number (as shown), then the environment variable configuration is successful.

![powershell enviornment variabled updated correctly](../assets/powershell_enviornment_variabled_updated_correctly.png)
![powershell enviornment variabled updated correctly](../../../assets/powershell_enviornment_variabled_updated_correctly.png)


NOTE. Windows 7 SP1 users might encounter an error "Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'api-ms-win-core-console-l2-1-0.dll': The specified module could not be found". The required 'api-ms-win-core-console-l2-1-0.dll' file is only found in Windows 8 or later versions. This error can be resolved by obtaining a copy of 'api-ms-win-core-console-l2-1-0.dll' and putting it in the directory C:\Windows\System32. This dll can be found in other folders on your computer(search it, then copy it to \System32), or alternatively found online.
Expand All @@ -79,11 +79,11 @@ NOTE. Windows 7 SP1 users might encounter an error "Unhandled Exception: System.

After the above installation configuration is successful, you can create a NeoContract project in Visual Studio 2017.

![new smart contract project](../assets/new_smart_contract_project.png)
![new smart contract project](../../../assets/new_smart_contract_project.png)

Once you create a project, it will automatically generate a C# file. The default class which inherits the SmartContract is shown in the following:

![smart contract function code](../assets/smart_contract_function_code.png)
![smart contract function code](../../../assets/smart_contract_function_code.png)


## Compile the Project
Expand All @@ -102,6 +102,6 @@ public class Contract1 : SmartContract

After you compile it successfully you will see `SmartContract1.avm` in the `bin/Debug` directory, which is the file that is generated as the NEO smart contract.

![compile smart contract](../assets/compile_smart_contract.png)
![compile smart contract](../../../assets/compile_smart_contract.png)

Now that you have completed the configuration of the NEO smart contract development environment.
10 changes: 5 additions & 5 deletions en-us/sc/quickstart/getting-started-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Download and install:

The installation process is very simple, follow the operation prompts step-by-step, it should be noted that you need to check the installation of `.NET Core cross-platform development`, otherwise you will not be able to open neo-vm project in step #3. The installation takes about ten minutes or up to an hour.

![install net core cross-platform development toolset](../assets/install_core_cross_platform_development_toolset.png)
![](../../../assets/install_core_cross_platform_development_toolset.png)

### 2. neo-compiler

Expand All @@ -54,9 +54,9 @@ Download the [neo-compiler](https://github.com/neo-project/neo-compiler) project

Publish the neoj compiler (which converts Java bytecode to the AVM bytecode).

![publish NEO compiler neoj](../assets/publish_neo_compiler_neoj.png)
![publish NEO compiler neoj](../../../assets/publish_neo_compiler_neoj.png)

![publish and profile settings](../assets/publish_and_profile_settings.png)
![publish and profile settings](../../../assets/publish_and_profile_settings.png)

After the release is successful, the neoj.exe file is generated in `bin\Release\PublishOutput`.

Expand Down Expand Up @@ -101,11 +101,11 @@ We now need to add this directory to our execution path. The PATH is the system
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK.

![edit environmental variables](../assets/edit_environmental_variables.png)
![edit environmental variables](../../../assets/edit_environmental_variables.png)

Now run Command or PowerShell, and enter neoj.exe. If there is no error and the output shows the version number (as shown) the environment variable configuration is successful

![powershell enviornment variabled updated correctly](../assets/powershell_enviornment_variabled_updated_correctly.png)
![powershell enviornment variabled updated correctly](../../../assets/powershell_enviornment_variabled_updated_correctly.png)


NOTE. Windows 7 SP1 users might encounter an error "Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'api-ms-win-core-console-l2-1-0.dll': The specified module could not be found". The required 'api-ms-win-core-console-l2-1-0.dll' file is only found in Windows 8 or later versions. This error can be resolved by obtaining a copy of 'api-ms-win-core-console-l2-1-0.dll' and putting it in the directory C:\Windows\System32. This dll can potentially be found in a number of places throughout one's system(search your computer and copy/past it into \System32), but alternatively can be found online.
Expand Down
2 changes: 1 addition & 1 deletion en-us/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
href: sc/quickstart/getting-started-csharp.md
- name: Using C# (macOS)
href: sc/quickstart/getting-started-csharp-mac.md
- name: Using C# (uubuntu)
- name: Using C# (ubuntu)
href: sc/quickstart/getting-started-csharp-ubuntu.md
- name: Using Java
href: sc/quickstart/getting-started-java.md
Expand Down
54 changes: 27 additions & 27 deletions zh-cn/sc/quickstart/getting-started-csharp-ubuntu.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,46 @@

1. 在 dotnet 命令行中创建 library 项目:

```
mkdir NeoContractDemo
cd ./NeoContractDemo/
dotnet new library
rm ./Class1.cs
vim NeoContractDemo.cs
```
```c#
mkdir NeoContractDemo
cd ./NeoContractDemo/
dotnet new library
rm ./Class1.cs
vim NeoContractDemo.cs
```

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

2. 键入下面代码后按 `ESC`+`wq!` 保存退出。

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

public class NeoContractDemo: SmartContract
{
public static bool Main()
{
return true;
}
}
```
public class NeoContractDemo: SmartContract
{
public static bool Main()
{
return true;
}
}
```

3. 添加智能合约引用:

```
dotnet add package Neo.SmartContract.Framework --version 2.5.4
```
```
dotnet add package Neo.SmartContract.Framework --version 2.5.4
```

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

4. 编译智能合约项目:

```
dotnet publish -o ../testlib
```
```
dotnet publish -o ../testlib
```

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

## 生成编译器

Expand Down
2 changes: 1 addition & 1 deletion zh-cn/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
href: sc/quickstart/getting-started-csharp.md
- name: 使用C# (macOS)
href: sc/quickstart/getting-started-csharp-mac.md
- name: 使用C# (uubuntu)
- name: 使用C# (ubuntu)
href: sc/quickstart/getting-started-csharp-ubuntu.md
- name: 使用 Java
href: sc/quickstart/getting-started-java.md
Expand Down

0 comments on commit 7a65ade

Please sign in to comment.