T4MVC / R4MVC

R4MVC is a Roslyn code generator for ASP.NET Core MVC apps that creates strongly typed helpers that eliminate the use of literal strings in many places
Apache License 2.0
157 stars 48 forks source link

DotNet Cli tooling support #64

Closed artiomchi closed 6 years ago

artiomchi commented 7 years ago

While both the PowerShell and toe dotnet cli tooling will run the same executable, they will be invoked somewhat separately. The PowerShell commands are triggered by the PS Module bundled with the R4Mvc.Tools package, and already works well.

For the dotnet cli to work, we need to either register the package as a cli tool package, or have a separate package to do that. So far I'm leaning towards the second approach, and will have to make it trigger the code from the first package.

There are some complications about this. Mainly because it seems like the DotNetCliTool packages have to have the same frameworks as the web project, otherwise they will be marked as incompatible. Since the tool itself runs .NET Framework code, and AspNetCore projects can run on .NET Core, this prevented me from registering the R4Mvc.Tools project as a cli tool.

I'm still experimenting with some options, and will try find the best approach. I believe this should be a required feature for v1, since not everyone runs their projects on Windows in VS :)

xsoheilalizadeh commented 7 years ago

Hi @artiomchi, this feature does work on Rider IDE? or I must do create a new issue for Rider Support?

artiomchi commented 7 years ago

Hmm.. The dotnet cli is not finished yet, but the plan is to make this the general command line triggered option, which means it should work from any IDE, as long as it has a way to run dotnet commands. I haven't used Rider IDE, so I can't comment on that last part, unfortunately.

In the meantime, if you don't use VS, the only way to trigger the generator is to use the command line. (find where .NET copies your packages (usually %UserProfile%\.nuget), and trigger the R4Mvc tools executable passing the path to your csproj as an argument. Once this issue is done though, it'll be a LOT easier :)

artiomchi commented 6 years ago

There's some progress with running r4mvc as a cli tool. There's a discussion open in #103 in terms of how to proceed, and an example on how to test the first build

artiomchi commented 6 years ago

The new cli generator tool is now live. You can check the updated documentation for details in how to use it: Intallation instructions