How to get Visual Studio 'Publish' functionality to include files from post build event?

后端 未结 6 2130
北海茫月
北海茫月 2020-12-02 05:32

I am currently attempting to use Visual Studio 2010 \'Publish\' and MSDeploy functionality to handle my web deployment needs but have run into a roadblock with regards to cu

6条回答
  •  被撕碎了的回忆
    2020-12-02 05:44

    I found a workaround for the problem by using the ExcludeFilesFromDeployment element within the project file. I got the idea from Web Deployment: Excluding Files and Folders

    So if you need to package project files as they exist in your project directory after a successful build and associated post build steps then do the following.

    1. Edit "Package/Publish Web" project settings and
      select Items to deploy to be "All files in this project folder"
    2. Unload the project
    3. Right click on the unloaded project and select to edit the project config
    4. Locate the PropertyGroup element associated to the configuration setting e.g. "Release"
    5. Within the PropertyGroup element add in the following elements and exclude files and folders you don't want in the package

      *.cs;**\.svn\**\*.*;Web.*.config;*.csproj*
      .svn;Controllers;BootstrapperTasks;Properties
      
    6. Save and reload your project

    This solves my problem for the time being but if there is a better solution then please let me know, as this is not ideal due to the hackery involved, but then again perhaps this is an uncommon deployment scenario?

提交回复
热议问题