如何创建仅将 JavaScript/CSS 添加到基于 Web 的项目的 NuGet 包? [英] How to create NuGet package that add only JavaScript/CSS to web-based project?

查看:51
本文介绍了如何创建仅将 JavaScript/CSS 添加到基于 Web 的项目的 NuGet 包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些 NuGet 包,其中包含 DLL 文件和 Web 相关文件,如 JavaScript、样式表和图像文件.我想创建只将 web 相关文件安装到 web 项目的包(包括 ASP.NET 和 ASP.NET MVC 项目).最简单的方法是什么?

I have some NuGet package that contains both DLL file and web related files like JavaScript, Stylesheet and image files. I want to create package that only install web related file to web project only (including ASP.NET and ASP.NET MVC project). What is the easiest way to do that?

谢谢

附注.我认为应该可以通过 Powershell 脚本实现.但我想,这对我来说很复杂.

PS. I think it should be possible via Powershell script. But I think, it is quite complex for me.

推荐答案

您可能想要使用 Nuget Package Explorer.它允许您在没有命令行的情况下创建一个包,并只将所需的文件添加到您的包中(加上一些简单的配置).

You probably want to use the Nuget Package Explorer. It allows you to create a package without the command line and add only the required files to your package (plus some easy config).

如果我理解正确的话,您有时只想安装 DLL,有时需要安装 DLL 和 Web 内容.在这种情况下,最好为 DLL 创建一个单独的包,然后是另一个包含 Web 内容的包,该包将 DLL 包指定为 Web 包的依赖项.这样,当您添加 Web 内容时,它会自动添加 DLL.

If I understand you correctly, you sometimes want to install just the DLL, and sometimes the DLL plus the web stuff. In this case it's best to create a separate package for the DLL, then another package with the web stuff which specifies the DLL package as a dependency of the Web package. This way it will automatically add the DLL when you add the Web content.

这是有关 Nuget Package Explorer 的教程,它将可能会帮助你.

这篇关于如何创建仅将 JavaScript/CSS 添加到基于 Web 的项目的 NuGet 包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆