开发者

Different ASP.NET 4 page contents depending on build type

While working 开发者_如何学JAVAon ASP.NET MVC 2 web site I faced to the following problem. I need to render speacial script on site's master page for Google analytics when building solution for production, but for debug and test builds this script should not be rendered. I've tried to find a way to make it automatically, but was not succeded in finding a solution.

The only idea I have is create a batch file that will append necessary script into the page before production build and remove after. But I wonder is there any better solution to solve this problem?


You should be able to use preprocessor directives

#if !DEBUG
               //render code here
#else
              //render something else
#endif

http://msdn.microsoft.com/en-us/library/ed8yd1ha(v=VS.100).aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜