locked
How do I disable "code optimizations" for my MVC .DLLs in Visual Studio 2012 permanently for debugging purposes? RRS feed

  • Question

  • User-1851576699 posted

    I am trying to debug my MVC application .DLL on IIS 7.5. I've got most of it working but now my .DLL always seems to show up in the "Modules" window as "optimized". Which completely destroyes most of the reasons for debugging which is to see the variable values at various stages in the code. I followed a tip one time of deleting the .DLL in the "Temporary ASP.NET Files" folder and this seemed to work for awhile. I've tried this a few times recently and it feels like I am just playing the lottery at this point hoping that it works but never seems to.

    "Visual Studio 2012 - Settings" during "Build->Publish" action. Configuration = Debug, Build->General->Optimize Code = unchecked.

    web.config file for my application .DLL under inetpub/wwwroot folder on node element <compilation> has attribute debug set equal to "true".

    Any other hoops someone can recommend I jump through to turn off code optimizations? I read something about creating an .ini file that matches the name of my application. But does that work for .DLLs also? Where would I put that file....in the Temporary ASP.NET Files folder with my .DLL....or the actual path of my .DLL under inetpub/wwwroot?

    **EDIT**: Okay, I solved this problem. It seems that I was deleting the .DLL in the Temporary ASP.NET Files folder but when I would re-publish my application the .DLL in my Users\Documents\Visual Studio 2012\Projects folder would get republished so I kept getting back the same .DLL that I was deleting. So, it seems my problem is solved for the moment. Although, the fact that I actually have to do this just to be able to step through my code on IIS 7.5 leaves me questioning whether I have actually found a solution. I would call it more of a hack.

    Friday, October 4, 2013 9:13 AM

Answers

  • User-166373564 posted

    Hi,

    Okay, I solved this problem. It seems that I was deleting the .DLL in the Temporary ASP.NET Files folder but when I would re-publish my application the .DLL in my Users\Documents\Visual Studio 2012\Projects folder would get republished so I kept getting back the same .DLL that I was deleting. So, it seems my problem is solved for the moment. Although, the fact that I actually have to do this just to be able to step through my code on IIS 7.5 leaves me questioning whether I have actually found a solution. I would call it more of a hack.

    Thanks for your feedback.

    As we know, without optimizations the compiler produces very dumb code - each command is compiled in a very straightforward manner, so that it does the intended thing. The Debug builds have optimizations disabled by default, because without the optimizations the produced executable matches the source code in a straightforward manner.

    For this issue, perhaps your application isn't published successfully.  If it still has same issue, please don’t hesitate to let me know,

    Regards

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 8, 2013 10:35 PM