是否可以过滤 Web 设置项目的 ContentFiles 子文件夹中的文件?
我有一个网络设置项目和一个网站包含在同一解决方案中。 在设置项目中,我添加了指向网站内容的内容文件
。
在此网站中,有一些文件夹包含动态生成的文件(即.log 文件、一些图像文件等),我不希望这些文件包含在安装程序中。我尝试添加过滤器 Symbols\*.png
但这不起作用。我还尝试了一个名为 *.png
的过滤器,这排除了该文件夹中的 .png 文件,但问题是它也排除了网站中必须存在的所有静态 .png 文件。
如何添加一个过滤器,仅排除我想要的目录下的文件?
删除文件后是否可以在 PreBuildEvent 中调用某些内容来告诉 VS 刷新网站内容?
还有其他方法可以解决这个问题吗?
I have a web setup project and a web site included in the same sollution.
In the setup project, I have added Content files
pointing to the web site content.
In this web site there are some folders that contains dynamically generated files (i.e .log files, some image files etc.) I do not want these files to be included in the setup. I have tried to add a filter Symbols\*.png
but this does not work. I have also tried a filter called *.png
, and this excludes the .png files within that folder, but the problem is it also excludes all static .png files in the web site that must be there.
How can I add a filter that excludes only the files under the directory I want?
Is it possible to call something in the PreBuildEvent
after the files are deleted that will tell VS to refresh the web site content?
Are there any other approaches that can solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否尝试过使用记事本编辑 .csproj 文件并添加类似内容:
其中 ItemGroup 在以下行之后:
您可以在以下文章中找到更多信息:http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageInclusionExtraFilesOrExducingSpecificFiles.aspx
Have you tried to edit your .csproj file with notepad and add something like:
where ItemGroup is after the following line:
More info you can find in the following article: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx
作为一种解决方法,我创建了一个 PreBuildEvent 来删除所有不应包含在设置中的文件:
这实际上会在我开始构建时删除这些文件,但会在稍后的构建中导致错误,因为安装内容认为应该存在的某些内容文件不存在。已删除的文件仍会在 VS 中作为网站内容进行引用。如果我浏览网站中的文件夹,我会看到已删除的文件位于 VS GUI 中(尽管文件实际上已被删除)。我必须对网站项目进行刷新以告诉VS内容已更改,然后再次进行构建。然后它就可以工作了,我的设置包含了我想要的内容。
As a workaround, I have created a PreBuildEvent that deletes all the files that should not be included in the setup:
This actually deletes the files when I start the build, but it causes an error later in the build, because some content files does not exist that the setup content thinks should be there. The files that are deleted, are still referenced in VS as content in the web site. If I browse the folders in the web site, I see that the deleted files are there in the VS GUI (although the files are actually deleted). I have to do a refresh on the web site project to tell VS that the content has changed, and then do the build again. Then it works, and my setup contains what I want.