问题描述
我经常增添了不少内容文件(主要是图片和JS)的到我的ASP.NET项目。我使用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?
推荐答案
旧线,我知道,但我发现了一个办法做到这一点,我总是忘记,和我的搜索来找到它最后一次,我偶然发现这个问题。我发现这是最好的办法是使用BeforeBuild目标在.csproj的文件。
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项目文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!