BizStream.AspNetCore.ViewComponentAssets
0.0.1-beta.3f23788
.NET 5.0
This package targets .NET 5.0. The package is compatible with this framework or higher.
.NET Core 3.1
This package targets .NET Core 3.1. The package is compatible with this framework or higher.
This is a prerelease version of BizStream.AspNetCore.ViewComponentAssets.
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BizStream.AspNetCore.ViewComponentAssets --version 0.0.1-beta.3f23788
NuGet\Install-Package BizStream.AspNetCore.ViewComponentAssets -Version 0.0.1-beta.3f23788
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="BizStream.AspNetCore.ViewComponentAssets" Version="0.0.1-beta.3f23788" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BizStream.AspNetCore.ViewComponentAssets --version 0.0.1-beta.3f23788
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BizStream.AspNetCore.ViewComponentAssets, 0.0.1-beta.3f23788"
#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 BizStream.AspNetCore.ViewComponentAssets as a Cake Addin #addin nuget:?package=BizStream.AspNetCore.ViewComponentAssets&version=0.0.1-beta.3f23788&prerelease // Install BizStream.AspNetCore.ViewComponentAssets as a Cake Tool #tool nuget:?package=BizStream.AspNetCore.ViewComponentAssets&version=0.0.1-beta.3f23788&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
mvc-component-assets
Attributes and TagHelpers for rendering static assets (.js
) associated with ViewComponents.
Usage
- Install the
AspNetCore
package into the ASP.NET Core Mvc project:
dotnet add package BizStream.AspNetCore.ViewComponentAssets
OR
<PackageReference Include="BizStream.AspNetCore.ViewComponentAssets" Version="x.x.x" />
- Configure services in the
Startup.cs
of the Mvc project:
using BizStream.AspNetCore.ViewComponentAssets;
using Microsoft.Extensions.DependencyInjection;
// ...
public void ConfigureServices( IServiceCollection services )
{
services.AddMvc()
// support ViewComponentAssets annotations/tag helpers
.AddViewComponentAssets();
}
public void Configure( IApplicationBuilder app, IWebHostEnvironment environment )
{
// ...
}
- Annotate a
ViewComponent
:
using BizStream.AspNetCore.ViewComponentAssets.Annotations;
using Microsoft.AspNetCore.Mvc;
namespace MyComponents;
[ViewComponentScript("/scripts/my-view-component.js")]
public class MyViewComponent : ViewComponent
{
public override IViewComponentResult Invoke( ) => Content( "Hello, World!" );
}
- Use TagHelpers in Views:
@using MyComponents;
@addTagHelper *, BizStream.AspNetCore.ViewComponentAssets
<body>
@(await Component.InvokeAsync<MyViewComponent>())
<view-component-scripts />
</body>
- Rendered HTML contains
<script />
elements forViewComponentScript
s:
<body>
Hello, World!
<script src="/scripts/my-view-component.js" />
</body>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETCoreApp 3.1
- No dependencies.
-
net5.0
- No dependencies.
-
net6.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.0.1-beta.f24ffa4 | 166 | 11/19/2021 |
0.0.1-beta.aa6527f | 134 | 11/19/2021 |
0.0.1-beta.67ca324 | 158 | 11/19/2021 |
0.0.1-beta.5af9fb0 | 234 | 11/19/2021 |
0.0.1-beta.3f23788 | 149 | 11/19/2021 |