Writing NEO Smart contracts in C #

Source: Internet
Author: User
Tags dotnet

Tools, extension and update installation Neocontractplugin plug-ins

Open Visual Studio 2017, open 工具 , 扩展和更新 Click on the left 联机 , search Neo, install NeoContractPlugin the plugin (the process requires networking):

Tools, extensions and updates

Online, search "Neo", download "Neocontractplugin"

    1. Neo-compiler

Download the Neo-compiler project on Github, open the solution with Visual Studio 2017 and publish the Neon Project in it:

Neon Project default publishing platform for win10-x64, if you are not WINDOWS10 system, you need to modify the publishing platform, open the Neon.csproj file with a text compiler, will <runtimeidentifiers>win10-x64 </RuntimeIdentifiers> Change to target platform, such as<runtimeidentifiers>win7-\</runtimeidentifiers>  , and then republish the project with VS. Detailed RIDs can refer to the. NET Core Runtime IDentifier (RID) catalog

"Note" Issues encountered during the publishing process:

Consulting with neo developers, said vs2017 and Dotnetcore this is a bit of a problem, it is recommended that I use the command line to publish:

Enter the Neon directory
Run command: dotnet publish-r win10-x64-c Debug
R parameter C parameters can be filled according to your preferences

Run command dotnet publish-r win10-x64-c Debug

Verify the success of the directory to see if there is an EXE file, and some words are successful:

There are neon application files

Once the command runs successfully, click the Publish button again.

    1. modifying environment variables

After the publication is successful, the files are generated in the bin\Release\PublishOutput directory neon.exe :

Then you need to add the path, so that any location can access the EXE program:

Open File Explorer, this computer--Properties:

Then you need to add the path, so that any location can access the EXE program:

Open File Explorer, this computer--Properties:

Click "Advanced System Settings" and select "Environment variables":

Environment variables, advanced system settings

Select Path in the system variable and click "Edit":

After adding path, run cmd or PowerShell test (if you have already started CMD before adding path to turn off the restart), after entering neon, no error, the output version number of the message indicates that the environment variable configuration is successful:

Create a project

After the four-step installation configuration is successful, you can create a NEO Smart contract project (any of the. NET Framework versions) in Visual Studio 2017:

When the project is created, a C # file is automatically generated and the default class inherits from Smartcontract:

Error: The new Neocontract project cannot find the Neo namespace

Workaround:
In the VS right-click Solution file, tap Restore NuGet package, and in the output panel you will see "Restoring NuGet packages ...". After all packages have been restored successfully, if the code still has an error, and there is still an exclamation mark in the "References" on the right, you can try double-clicking the exclamation point:

Compiling the project

Click Build, Build solution (shortcut CTRL + Shift + B) on the menu bar to start compiling the program:

After the compilation is successful, you will see the generated file in the project bin/Debug directory, which is the 项目名.avm generated NEO smart contract file:

Reprinted from https://www.jianshu.com/p/d0da4ec13716

Writing NEO Smart contracts in C #

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.