Here are the steps to get a development environment up and running to write smart contracts in .NET for the Antshares platform.
What we need:
- Visual Studio 2015 (Install the free community edition)
https://www.visualstudio.com/downloads/ - .NET Core tools Preview 2 (or newer) for Visual Studio 2015 : https://www.microsoft.com/net/download/core
- Antshares Visual Studio Plugin:
Open Visual Studio. Install from menu Tools -> Extensions and Updates -> Online -> Search Antshares: Antshares.SmartContract - AntShares.Compiler.MSIL project: https://github.com/AntShares/AntShares.VM
Download as .zip – Unzip and open the .sln file in Visual Studio
Build the AntShares.Compiler.MSIL project, we will reference the build output in the System environment Path variable. You could do this in command line or by going to the Windows variables where you select the Path value in System variables:
Add the folder UnzipDirectory\AntShares.VM-master\src\AntShares.Compiler.MSIL\bin\Debug\netcoreapp1.0\win10-x64
If all is well so far, you can type the following command in your prompt: AntShares.Compiler.MSIL and see if this is recognised:
Thanks to the Antshares visual studio project, it's easy to start a smartcontracts project, just select the new template AntShares.SmartContract.Template:
After the project opened, I ran into a small problem. The DLL “AntShares.SmartContract.Framework” in my references did not load correctly. I fixed it by running “manage NuGet packages” in the project, and restoring AntShares.SmartContract.Framework.
Then you can successfully build the project with the empty contract:
And now you're all ready to start doing the difficult part: writing that damn contract...
Happy coding!