AArnott / CodeGeneration.Roslyn

Assists in performing Roslyn-based code generation during a build.
Microsoft Public License
408 stars 59 forks source link

Error with dotnet-codegen #42

Closed bhugot closed 7 years ago

bhugot commented 7 years ago

Hello,

I try to do a sample following your readme but I can't compile it.

I got an error in Task "GenerateCodeFromAttributes" dotnet codegen

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.CommandLine, Version=0.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.

AArnott commented 7 years ago

It looks like your package restore was incomplete. It looks like the README talks about this, but only in the context of packaging up your code generator which may not even apply to you. But the nuget.config change applies to everyone. Per the very end of the readme then, please add this nuget.config file to your repo:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="corefxlab" value="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json" />
  </packageSources>
</configuration>
bhugot commented 7 years ago

The package for this lib is in my nuget cache and I followed your readme

AArnott commented 7 years ago

Are you sure your package cache has the 0.1.0.0 version? Or is it a 1.0 version? Also, please review your package restore logs for any warnings about pulling in a newer version than the one that was requested.

bhugot commented 7 years ago

I had the 0.1.0.0 in the same one you load in your project. I m off work I will check next monday

AArnott commented 7 years ago

No idea why it would fail then. Does dotnet codegen fail at the command line as well?

bhugot commented 7 years ago

Made it work, it was a problem with the dotnet sdk preview version I had. I updated it and it's working.

Thanks