2

我正在使用 Visual Studio 2012 并且正在使用 JavaScript 框架 ( Ext JS )。我的 HomeController 基本上重定向到 Ext JS 使用的索引。它与实际使用 .NET(通过 CORS)的其他 Visual Studio 项目进行通信,但这个特定项目只包含我的 JavaScript 应用程序。

我想发布这个 Visual Studio 项目,但有一个问题。与 Ext JS 一起使用的名为 Sencha Command 的工具用于创建 JavaScript 应用程序的生产版本。它基本上创建了一个独立的构建文件夹,其中包含所有组合和缩小的 JavaScript 脚本、所需资源、已编译的Sass等。它在某些情况下工作得非常好,但我不知道如何让它与 Visual Studio 配合得很好在发布时。

我已经弄清楚如何使用构建后命令运行 sencha 命令,该命令检查我是否处于调试模式,但我不希望生成的文件夹成为我实际项目的一部分,而且我也不希望发布尚未编译的代码。我知道如何在我的 pubxml 文件中省略一个文件夹。但我需要做一些事情,比如将构建文件夹移动到发布位置。

有没有人遇到过这样的场景?有没有更好的方法来解决这个问题?

这是我当前的 pubxml:

<?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>
    <SiteUrlToLaunchAfterPublish />
    <publishUrl>C:\Users\TestUser\Desktop\Release</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
    <ExcludeFoldersFromDeployment>
      js/ext;js/App
    </ExcludeFoldersFromDeployment>
  </PropertyGroup>
  <Target Name="BeforePublish" BeforeTargets="FileSystemPublish">
    <Exec Command="echo Hello" />
  </Target>
</Project>

注意:我认为 BeforePublish 不起作用。我在那里尝试了许多命令,包括“sencha app build”命令,后来我将其移至构建后命令。

4

0 回答 0