忽略MSDeploy和MSBuild中的目录 [英] Ignore Directory in MSDeploy and MSBuild

查看:185
本文介绍了忽略MSDeploy和MSBuild中的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Visual Studio中的发布网站"功能部署的网站项目.我了解此功能使用WebDeploy(MSDeploy)来调用MSBuild来编译站点.

I have a Web Site project that is deployed using "Publish Web Site" feature in Visual Studio. I understand this feature uses WebDeploy (MSDeploy) which calls MSBuild to compile the site.

网站中有一个目录,WebDeploy和MSBuild都需要忽略该目录,因为它会破坏站点.

There is a directory within the website that needs to be ignored by both WebDeploy and MSBuild because it breaks the site.

我能够配置部署配置文件(.pubxml),以使WebDeploy忽略目录:

I was able to configure the deployment configuration file (.pubxml) to make WebDeploy ignore directory:

  <PropertyGroup>
    ...
    <ExcludeFoldersFromDeployment>node_modules</ExcludeFoldersFromDeployment>
  </PropertyGroup>

通过将目录隐藏在文件系统中,我还能够使网站得以编译.

I was also able to get the site to compile by making the directory hidden in the file system.

但是,当从WebDeploy调用时,我无法使MSBuild忽略该目录.

However, I am unable to get MSBuild to ignore the directory when called from WebDeploy.

在网站被编译后,如何忽略目录?

How do I ignore the directory anytime the site is compiled?

更新

编译器在失败时将其记录在输出"窗口中:

The compiler logs this in the Output Window when it fails:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.WebSite.Publishing.targets(172,5): Error MSB4018: The "CollectFilesinFolder" task failed unexpectedly.

推荐答案

您要应用跳过规则,以便同步过程完全忽略目录.

You want to apply a skip rule so that the directory is ignored by the synchronisation process completely.

将此添加到您的.pubxml文件:

<ItemGroup>
  <MsDeploySkipRules Include="SkipNodeModules">
    <AbsolutePath>node_modules</AbsolutePath>
  </MsDeploySkipRules>
</ItemGroup>

如果您遇到无法正常运行的问题,则可能会看到

If you run into problems with it not working, you may be seeing this problem. If so, just add:

<PropertyGroup>
  <UseMsDeployExe>true</UseMsDeployExe>
</PropertyGroup>

这篇关于忽略MSDeploy和MSBuild中的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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