AArnott / CodeGeneration.Roslyn

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

Add support for .NET Core 3.0 #160

Closed nwohlgemuth closed 5 years ago

nwohlgemuth commented 5 years ago

When building with .NET Core 3.0, I see the following warnings:

warning MSB3073: The command "dotnet codegen "....dotnet-codegen.rsp"" exited with code 1. warning CGR1000: dotnet-codegen: Failed to generate the list of generated files. The tool didn't run succesfully. Please check https://github.com/AArnott/CodeGeneration.Roslyn for usage instructions.

Which of course in turns causes errors because code generation failed. While .NET Core 3.0 is currently in preview, it will soon become the current release. Are there plans to add support?

amis92 commented 5 years ago

From the looks of it you're talking about using this tool in a project built with .NET Core 3.0 SDK.

Answering your question: The tool as it stands cannot target runtime v3.0 - see https://github.com/dotnet/announcements/issues/107

However as per your problem - if you got to this point, there is some other error. The tool is available and did run. Can you try looking at normal level verbosity logs? Look for target named GenerateCodeFromAttributes

nwohlgemuth commented 5 years ago

There was an earlier warning as well:

warning MSB3073: The command "dotnet codegen --version" exited with code 150.

nwohlgemuth commented 5 years ago

I think I have this figured out. If only the .NET Core 3.0 SDK is installed, then this issue will happen. If both 2.x and 3.0 are installed, it works fine.

amis92 commented 5 years ago

Well, and here I thought just having the 2.x runtime would suffice. :|

(Are you sure you had the 2.x runtime as well?)

Bonuspunkt commented 4 years ago

i hit this issue while trying to build with docker (docker pull mcr.microsoft.com/dotnet/core/sdk:3.1)

It was not possible to find any compatible framework version
  The framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
    - The following frameworks were found:
        3.1.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  You can resolve the problem by installing the specified framework and/or SDK.

/root/.nuget/packages/codegeneration.roslyn.buildtime/0.4.88/build/CodeGeneration.Roslyn.BuildTime.targets(59,5): warning MSB3073: The command "dotnet codegen "@obj/Release/netstandard2.1/my.csproj.dotnet-codegen.rsp"" exited with code 150. [/app/my.csproj]

besides i'm using an old version, what is the current plan?

seems like https://github.com/AArnott/CodeGeneration.Roslyn/blob/master/src/CodeGeneration.Roslyn.Tool/CodeGeneration.Roslyn.Tool.csproj needs to be updated to something like https://github.com/cake-build/cake/blob/develop/src/Cake/Cake.csproj ?

amis92 commented 4 years ago

@Bonuspunkt that was resolved in #178

edit: as a workaround until new version is out, you can set DOTNET_ROLL_FORWARD=Major environment variable. Should work.