locked
VS 11 Beta: set file package action depending on build configuration

    Question

  • Hello all,

    first of all, I hope this is the correct forum to post to regarding the new Visual Studio from the Developer Preview of Windows 8.

    Now on to the matter at hand: I'd like to have some of my projects files only packaged when doing a debug build and ignored in Release builds. This doesn't seem to work at the moment and the structure of the project file XML suggests that it isn't possible at all.

    As things are, the whole header in the file properties dialog doesn't make a whole lot of sense if selecting another configuration or platform doesn't do anything in the dialog itself.

    All the best

    Marcus

    Edit: I should probably mention that this is a WinJS HTML5/JavaScript project. :)

    • Edited by Marcus Ilgner Tuesday, February 28, 2012 9:34 AM
    • Moved by Forrest Guo Thursday, March 1, 2012 2:03 AM Move to appropriate forum (From:MSBuild)
    Monday, February 27, 2012 1:27 PM

Answers

  • There is no way to do this currently for JavaScript projects that will work properly in the Properties Window.  However, you can directly modify your .jsproj file to only include certain items when in the debug configuration:

    <Content Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'" Include="file.txt" />   
    <
    None Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'" Include="file.txt" />

    This will cause the file.txt to not get deployed/packaged when doing a Release build as it's PackageAction will be set to None.

    Friday, March 2, 2012 1:44 AM