有没有办法自动将内容文件包含到 asp.net 项目文件中? [英] Is there a way to automatically include content files into asp.net project file?

查看:23
本文介绍了有没有办法自动将内容文件包含到 asp.net 项目文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常向我的 ASP.NET 项目添加大量内容文件(主要是图像和 js).我正在使用 VS 发布系统,并且在发布时,新文件在我将它们包含在项目中之前不会发布.我想自动包含指定目录中的所有文件.有没有办法指定哪些目录应该自动包含在 csproj 文件或其他任何地方?

I'm frequently adding a lot of content files (mostly images and js) to my ASP.NET project. I'm using VS publish system, and on publish, new files are not published until I include them in the project. I would like to auto include all files in specified directory. Is there a way to specify which directories should be auto-included in csproj file or anywhere else?

推荐答案

旧线程,我知道,但我找到了一种方法来做到这一点,但我一直忘记,最后一次寻找它时,我偶然发现这个问题.我发现的最好方法是使用 .csproj 文件中的 BeforeBuild 目标.

Old thread, I know, but I found a way to do this that I keep forgetting, and on my search to find it one last time, I stumbled upon this question. The best way I've found to this is is to use the BeforeBuild target in the .csproj file.

<Target Name="BeforeBuild">
    <ItemGroup>
        <Content Include="***.less" />
    </ItemGroup>
</Target>

VS 2010 不会触及此部分,它确保您的文件在每次构建项目时都作为内容包含在内.

VS 2010 won't touch this section, and it ensures that your files are included as content every time the project is built.

这篇关于有没有办法自动将内容文件包含到 asp.net 项目文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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