【发布时间】:2014-10-20 22:08:33
【问题描述】:
使用 Visual Studio 和 MSBuild,我希望能够在我的部署中排除所有 .js 文件并包含所有 .min.js 文件。
我知道这可以使用 Visual Studio 中的文件属性来实现,但这不是一个选项,因为文件太多。
我的 Visual Studio 项目中有以下 PublishProfile。除了<ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit http://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Delpoy-Static</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>True</ExcludeApp_Data>
<publishUrl>\\***\wwwroot\***.com\static</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
<!--This does not work, but gives the idea of what I want to achieve-->
<ItemGroup>
<Deploy Exclude="**\*.js" Include="**\*.min.js" />
</ItemGroup>
</Project>
这可以使用PublishProfile 实现吗?如果是这样,怎么做?
【问题讨论】:
-
如果您愿意,我可以在 MSBuild 方面为您提供帮助,但我建议您发布忽略 blogs.msdn.com/b/webdev/archive/2013/08/22/…。如果您仍然需要 MSBuild 发布配置文件解决方案,您可以看看并告诉我吗?
-
谢谢,这看起来很棒,我只需要弄清楚如何使用可用的语法忽略
.js文件而不是.min.js文件。发布忽略是否严格遵循 gitignore 语法? -
好像不是
Error MSB4018: The "ReadPublishIgnoreFile" task failed unexpectedly. System.NotSupportedException: The ! operator is not currently supported in publish.ignore at InlineCode.ReadPublishIgnoreFile.Execute() in c:\Users\sblowes\AppData\Local\Temp\bzp34wjd.0.cs:line 89 at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() -
对不起,我忘记了我从未实现过对 ! 的支持。我已经打开了一个问题来跟踪它github.com/ligershark/publish-ignore/issues/8。我也在下面回答了。
标签: visual-studio deployment build msbuild msdeploy