2

I am using Visual Studio 2012 and am working with a JavaScript framework (Ext JS). My HomeController basically redirects to the index that Ext JS uses. It communicates with other Visual Studio projects that actually make use of .NET (via CORS), but this particular project just contains my JavaScript application.

I want to publish this Visual Studio project, but there is a catch. A tool that is used with Ext JS, named Sencha Command, is used to create a production version of the JavaScript application. It basically creates a stand-alone build folder that contains all the JavaScript scripts combined and minified, required resources, compiled Sass, etc. It works out really well in some scenarios, but I am not sure how to make it play nice with Visual Studio on publish.

I have figured out how to get the sencha command to run with a post-build command that checks to see if I am in debug mode or not, but I don't want the generated folder to be part of my actual project, and I don't want the not-yet-compiled code to be published either. I know how to omit a folder in my pubxbml file. But I need to do something like move the build folder to the publish location.

Has anyone encountered scenarios such as this? Is there a better way to go about this?

Here is my current 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>

Note: I don't think the BeforePublish worked. I tried a number of commands there, including the "sencha app build" command which I later moved to a post-build command.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user2987995
  • 130
  • 2
  • 10
  • What file is this? I have a file named [MyAseembly].publish.xml but it looks nothing like this one. What version of .Net and VS are you using? Maybe it's MVC related... What version of MVC Framework is your project based on? – Brian Sweeney Jun 17 '14 at 17:30
  • I'm using VS2012 with ASP.NET MVC4. I believe the file was originally generated when I published for the first time. I had tried editing it such as above, but if I recall correctly, FileSystemPublish doesn't run the BeforePublish event. I think webdeploy does, which I later switched to. I never actually solved the above question since the application is not live yet, so I will likely return to this in the future. The file is located in Properties/PublishProfiles/[projectname].pubxml for me – user2987995 Jun 17 '14 at 18:24
  • It all makes sense now. I'm using VS 2010 and MVC3. I needed to upgrade to the Azure tools to get the same setup that you have (testing this presently). Once upgraded you supposedly do something like this: http://stackoverflow.com/questions/12907236/how-to-execute-a-powershell-script-only-before-a-web-deploy-publish-task-in-vs-2 This may be helpful to you if I understand your question. This is what i'm going to try. – Brian Sweeney Jun 17 '14 at 19:22

0 Answers0