Closed Nihlus closed 4 years ago
@Nihlus and what did you attempt as a command for installing dotnet-codegen
?
Unfortunately, there's no command-line command to do that, you have to manually edit the project file.
Also, while you're at it, 0.7-alpha is unusable as seen in #195
@amis92 No command at first, just letting dotnet restore figure things out. After that failed, I ended up trying to install it as a global tool, which didn't work for the same but more verbose reason.
Strangely, it all started working for no apparent reason a little earlier today. I tried adding the tool with dotnet add package
first, and then changing it to a tool reference - apparently that jogged something, and the generators are working fine now.
I've attempted to recreate the issue on another computer, and there I can't get things to work at all. It still functions on my laptop, which is extremely bizarre.
EDIT: After some investigation, I found that I somehow had managed to install dotnet-codegen as a tool in my local nuget cache, and that was how it was working. I still have no idea how that happened. As far as I can tell, as long as the tool is updated to conform to the new SDK tool standards (with the package type and naming), it should work fine out of the box.
This will be fixed via #198.
When trying to create a new minimal project with 0.7.5-alpha, the installation of dotnet-codegen fails with a NU1212 error. The reason for this is, as far as I can tell, that the package type is explicitly specified in https://github.com/AArnott/CodeGeneration.Roslyn/blob/master/src/CodeGeneration.Roslyn.Tool/CodeGeneration.Roslyn.Tool.csproj#L4 as
DotnetCliTool
, whereas the most recent version ofdotnet
expectsDotnetTool
.A possible workaround or solution would be to drop the explicit package type specification, and use
<PackAsTool>true</PackAsTool>
instead (as seen in https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools-how-to-create).