UrlActionGenerator 0.4.0-alpha.4

This is a prerelease version of UrlActionGenerator.
There is a newer version of this package available.
See the version list below for details.
dotnet add package UrlActionGenerator --version 0.4.0-alpha.4                
NuGet\Install-Package UrlActionGenerator -Version 0.4.0-alpha.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="UrlActionGenerator" Version="0.4.0-alpha.4">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UrlActionGenerator --version 0.4.0-alpha.4                
#r "nuget: UrlActionGenerator, 0.4.0-alpha.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install UrlActionGenerator as a Cake Addin
#addin nuget:?package=UrlActionGenerator&version=0.4.0-alpha.4&prerelease

// Install UrlActionGenerator as a Cake Tool
#tool nuget:?package=UrlActionGenerator&version=0.4.0-alpha.4&prerelease                

UrlActionGenerator

NuGet Version Coverage Status

UrlActionGenerator is a C# Source Generator for ASP.NET Core apps that create strongly typed extension methods for the generation of URL's in ASP.NET Core projects.

So instead of writing this by using magical strings:

<a asp-controller="Home" asp-action="Index" asp-route-param="4">Link</a>

You can write the following with the advantages of autocomplete and strong types:

<a href="@Url.Actions().Home.Index(param: 4)">Link</a>

Installation

To start using this package, simply add the UrlActionGenerator package to your ASP.NET Core project by using the IDE tooling or running the below command:

dotnet add package UrlActionGenerator

How to use

Once the package is added, extension methods are automatically added to the IUrlHelper interface based on the following template:

For MVC:

IUrlHelper.Actions().[ControllerName].[ActionName](...parameters)
IUrlHelper.[AreaName]Actions().[ControllerName].[ActionName](...parameters)

For Razor Pages:

IUrlHelper.Pages().Folder.Page(...parameters)
IUrlHelper.[AreaName]Pages().Folder.Page(...parameters)

For more examples check out the wiki for MVC examples or Razor Pages examples.

Interested in contributing? check out the technical details.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.6.0 10,297 1/26/2022
0.5.0 301 12/21/2021
0.4.0 743 5/15/2021
0.4.0-alpha.6 166 5/10/2021
0.4.0-alpha.5 171 5/3/2021
0.4.0-alpha.4 158 5/2/2021
0.4.0-alpha.1 165 4/22/2021
0.3.0 391 3/14/2021
0.2.1 354 3/5/2021
0.2.0 361 3/5/2021
0.1.0 385 2/21/2021