AArnott / CodeGeneration.Roslyn

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

Sample won't build #163

Closed mhgamework closed 4 years ago

mhgamework commented 5 years ago

Im very excited about this library, but i cant get it to work.

I downloaded the sample project from github, installed dotnet core sdk 2.2 and build the sample using visual studio 2017. It doesnt compile and gives the following error:

Error occurred while restoring NuGet packages: The local source 'C:\_Data\CodeGeneration.Roslyn-master\bin\Packages\Debug' doesn't exist.
1>------ Build started: Project: Sample.Generator, Configuration: Debug Any CPU ------
1>Sample.Generator -> C:\_Data\CodeGeneration.Roslyn-master\samples\GeneratorInConsumerSolution\Sample.Generator\bin\Debug\netstandard2.0\Sample.Generator.dll
2>------ Build started: Project: Sample.Consumer, Configuration: Debug Any CPU ------
2>Version for package `dotnet-codegen` could not be resolved.
2>C:\Users\Michiel Huygen\.nuget\packages\codegeneration.roslyn.buildtime\0.6.1\build\CodeGeneration.Roslyn.BuildTime.targets(61,5): warning MSB3073: The command "dotnet codegen --version" exited with code 1.
2>C:\Users\Michiel Huygen\.nuget\packages\codegeneration.roslyn.buildtime\0.6.1\build\CodeGeneration.Roslyn.BuildTime.targets(73,5): error CGR1001: CodeGeneration.Roslyn.Tool (dotnet-codegen) is not available, code generation won't run. Please check https://github.com/AArnott/CodeGeneration.Roslyn for usage instructions.
2>Done building project "Sample.Consumer.csproj" -- FAILED.
========== Build: 1 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Am I missing something?

amis92 commented 5 years ago

Well, you'll need to first build nugets from the main project first (dotnet pack in the src folder) - that's because the sample uses locally built packages instead of NuGet.org source. The sample experience isn't really the best, I admit.

mhgamework commented 5 years ago

I will try that out, but before i tried the sample, i followed the readme to setup my own, using nuget sources, and i got the exact same error.

On Thu, Aug 29, 2019 at 11:49 PM Amadeusz Sadowski notifications@github.com wrote:

Well, you'll need to first build nugets from the main project first (dotnet pack in the src folder) - that's because the sample uses locally built packages instead of NuGet.org source. The sample experience isn't really the best, I admit.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AArnott/CodeGeneration.Roslyn/issues/163?email_source=notifications&email_token=AAA6V5WI7O7RXEO42BVSMQLQHA757A5CNFSM4ISDSVQKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5P5VQQ#issuecomment-526375618, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA6V5WEGUTNJLYWQDGO3P3QHA757ANCNFSM4ISDSVQA .

--

MHGameWork

amis92 commented 5 years ago

Have you followed the readme from sample folder? Have you replaced the * in Directory.Build.props? (it works without replacement on my machine, though)

amis92 commented 5 years ago

One error is the local folder nuget source not correctly resolving.

The other (from the log) is that

Version for package dotnet-codegen could not be resolved.

Which means the package version couldn't be discovered.

b3rnhard commented 5 years ago

@amis92 Have you checked #111 as well? Had the same issue and installing .NET Core 2.0 SDK fixed it for me (I think)

amis92 commented 4 years ago

I'll consider it resolved since there's no follow up.

msendetsky commented 4 years ago

Doesn't build for me even when having .Net Core SDK 2.0 installed:

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18363
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.1.201\

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  2.0.0 [C:\Program Files\dotnet\sdk]
  2.1.805 [C:\Program Files\dotnet\sdk]
  3.1.201 [C:\Program Files\dotnet\sdk]

VS 2019, v. 16.5.3

amis92 commented 4 years ago

@msendetsky please open a new issue and provide more details: what did you try to build, what was the error, etc.