New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use C# to write a NEO smart contract, step 3 fail and no verbose message. #368

Closed
jphellemons opened this Issue Jan 29, 2018 · 9 comments

Comments

6 participants
@jphellemons

jphellemons commented Jan 29, 2018

At http://docs.neo.org/en-us/sc/getting-started-csharp.html#compile-the-project
There is no info how to debug this message, or common pitfalls etc.

1>------ Rebuild All started: Project: NeoContract1, Configuration: Debug Any CPU ------
1>  NeoContract1 -> C:\Users\myuser\Documents\Visual Studio 2017\Projects\NeoContract1\NeoContract1\bin\Debug\NeoContract1.dll
1>  Start NeoContract converter, Source File: C:\Users\myuser\Documents\Visual Studio 2017\Projects\NeoContract1\NeoContract1\bin\Debug\NeoContract1.dll
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

Can I manually convert it using neon.exe in order to get a more verbose message? I did update nuget packages before running all the code. ps. the screenshot of the output of neon.exe is a lot more these days.

I also moved neoa, neoj and neon to .net standard 2.0 before build it. But somehow neon.exe outputs version 1.0.1 is that because it uses an outdated neon vm?

@jphellemons

This comment has been minimized.

jphellemons commented Jan 30, 2018

https://steemit.com/neo/@cybourgeoisie/neo-contract-development-common-pitfalls-using-windows-7 says I just had to reboot Windows and restart Visual Studio, but that did not fix it. Is there a commandline option for neon.exe to manually start the contract converter and get a more verbose error?

@jphellemons

This comment has been minimized.

jphellemons commented Jan 30, 2018

Manual run dotnet build:

NeoContract1.csproj(65,5): error MSB4062: The "Neo.ConvertTask" task could not be loaded from the assembly C:\Users\myuser\Documents\Visual Studio 2017\Projects\NeoContract1\NeoContract1\Neo.ConvertTask.dll. Could not load file or assembly 'Microsoft.Build.Utilities.v4.0, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Het systeem kan het opgegeven bestand niet vinden. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

I've added the Microsoft.Build.Utilities.Core nuget but it's in the NEo.ConvertTask.dll and I do not know where that came from? It's probably output of the neo-compiler solution?

@chenzhitong

This comment has been minimized.

Member

chenzhitong commented Feb 1, 2018

manually convert it using neon.exe
image

@chenzhitong

This comment has been minimized.

Member

chenzhitong commented Feb 1, 2018

I guess the compilation failed because your neon version was too low, you should download the latest neon code to redistribute https://github.com/neo-project/neo-compiler
The version of NeoContractPlugin will be consistent with neon and NeoVM, if inconsistent there may be a problem of failed compilation, or compilation pass but failure to run. @jphellemons

@jphellemons

This comment has been minimized.

jphellemons commented Feb 1, 2018

A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found

perhaps because I thought .net core 2 was forward compatible and I moved the neon project to 2.0

@jphellemons jphellemons closed this Feb 1, 2018

@Vimal123

This comment has been minimized.

Vimal123 commented Feb 24, 2018

@jphellemons
i get same error, can you please tell me the right solution for this.

Thank you.

@bobio2018

This comment has been minimized.

bobio2018 commented Mar 9, 2018

@chenzhitong I ran into a similar build failure for ConvertTask

1>Using "ConvertTask" task from assembly "C:\Development\Tutorial\NeoContract\NeoContract\Neo.ConvertTask.dll".
1>Task "ConvertTask"
1>Done executing task "ConvertTask" -- FAILED.
1>Done building target "AfterBuild" in project "NeoContract.csproj" -- FAILED.
1>
1>Build FAILED.

I run the compiler manually then it did generate neocontract.abi.json and neocontract.avm . I did download the latest the compiler from https://github.com/neo-project/neo-compiler (Latest commit 9777729 on Jan 14)
below is my compiler version

C:\Development\Tutorial\NeoContract\NeoContract\bin\Debug>neon
Neo.Compiler.MSIL console app v2.0.3.1
need one param for DLL filename.

C:\Development\Tutorial\NeoContract\NeoContract\bin\Debug>neon.exe neocontract.dll
Neo.Compiler.MSIL console app v2.0.3.1
Find entrypoint:System.Void NeoContract.Contract1::Main()
convert succ
gen abi succ
write:neocontract.avm
write:neocontract.abi.json
SUCC
@BSathvik

This comment has been minimized.

Contributor

BSathvik commented Mar 13, 2018

I have the same exact problem. Any solutions ?

@skkiran

This comment has been minimized.

skkiran commented Apr 3, 2018

I had same issue. Restarting visual studio after adding "directory of neon.exe" into the PATH (as in section 3 of http://docs.neo.org/en-us/sc/getting-started-csharp.html) resolved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment