BizStream.AspNetCore.ViewComponentAssets
0.0.1-beta.f24ffa4
.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.
dotnet add package BizStream.AspNetCore.ViewComponentAssets --version 0.0.1-beta.f24ffa4
NuGet\Install-Package BizStream.AspNetCore.ViewComponentAssets -Version 0.0.1-beta.f24ffa4
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.f24ffa4" />
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.f24ffa4
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.f24ffa4"
#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.f24ffa4&prerelease // Install BizStream.AspNetCore.ViewComponentAssets as a Cake Tool #tool nuget:?package=BizStream.AspNetCore.ViewComponentAssets&version=0.0.1-beta.f24ffa4&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
mvc-component-assets
Annotations and TagHelpers for rendering static assets (.js
, .css
) 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;
using Microsoft.AspNetCore.Mvc;
[ViewComponentScript("/scripts/my-view-component.js")]
public class MyViewComponent : ViewComponent
{
public override IViewComponentResult Invoke( ) => Content( "Hello, World!" );
}
- Use TagHelpers in Views:
@* ... *@
<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 | 164 | 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 |