Reputation: 1251
In C++ and C# applications one can define conditional compilation symbols, such as DEBUG, TRACE or RELEASE and use these in program code to enable/disable code generation with #if.
I need to do similar thing in a Windows 8 Metro Javascript application: have different builds (Debug/Release) behave slightly differently. Is this supported somehow?
Upvotes: 1
Views: 386
Reputation: 1251
I've found a way to determine the build configuration name. This might not be the most stable way of doing it but at least it works in the Developer Preview. It seems the string
Windows.ApplicationModel.Package.current.installedLocation.folderRelativeId
contains the build configuration name as a substring (e.g. ".Debug."). One can then use this information at run-time to do different things base on build configuration name.
Upvotes: 0
Reputation: 1778
In the Windows 8 Developer Preview, Visual Studio for Metro Style JavaScript applications there is no pre-processing of JavaScriot nor is there a compilation step. However, you can via MSBuild plug in your own pre-processor (or reuse the C one). You can just edit the .wwaproj file and add target that invokes your pre-processor.
<Target Name="BeforeBuild">
</Target>
There are a couple of good articles* online for doing a similar thing with minifying JavaScript in Visual Studio which is very similar to your requirements. * http://amusedia.blogspot.com/2010/11/minimize-javascript-and-css-with.html
Upvotes: 1