none
Website publishing in VS2013 > Debug always comes out as optimized RRS feed

  • Question

  • Hello,

    This morning I have been publishing both a debug and release build of a website that is merged into a single assembly with the "treat as a library component" enabled.

    I checked the assembly information afterwards to discover that the debug publish is actually compiled in release mode, and is optimized.

    Is this expected behaviour for a website publish?

    Here is the pubxml for the release version:

      <PropertyGroup>
        <TargetDir Condition="'$(TargetDir)'==''">..\</TargetDir>
        <PrecompileBeforePublish>True</PrecompileBeforePublish>
        <EnableUpdateable>False</EnableUpdateable>
        <DebugSymbols>False</DebugSymbols>
        <WDPMergeOption>MergeAllOutputsToASingleAssembly</WDPMergeOption>
        <UseMerge>True</UseMerge>
        <SingleAssemblyName>#########</SingleAssemblyName>
        <DeleteAppCodeCompiledFiles>True</DeleteAppCodeCompiledFiles>
      </PropertyGroup>
      <PropertyGroup>
        <WebPublishMethod>FileSystem</WebPublishMethod>
        <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
        <LastUsedPlatform>Any CPU</LastUsedPlatform>
        <SiteUrlToLaunchAfterPublish />
        <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
        <ExcludeApp_Data>True</ExcludeApp_Data>
        <publishUrl>$(TargetDir)Publish\Release\Offline\</publishUrl>
        <DeleteExistingFiles>True</DeleteExistingFiles>
      </PropertyGroup>

    And here is the pubxml for the debug version

       <PropertyGroup>
          <TargetDir Condition="'$(TargetDir)'==''">..\</TargetDir>
          <PrecompileBeforePublish>True</PrecompileBeforePublish>
          <EnableUpdateable>False</EnableUpdateable>
          <DebugSymbols>True</DebugSymbols>
          <WDPMergeOption>MergeAllOutputsToASingleAssembly</WDPMergeOption>
          <UseMerge>True</UseMerge>
          <SingleAssemblyName>#######</SingleAssemblyName>
          <DeleteAppCodeCompiledFiles>True</DeleteAppCodeCompiledFiles>
       </PropertyGroup>
       <PropertyGroup>
          <WebPublishMethod>FileSystem</WebPublishMethod>
          <LastUsedBuildConfiguration>Debug</LastUsedBuildConfiguration>
          <LastUsedPlatform>Any CPU</LastUsedPlatform>
          <SiteUrlToLaunchAfterPublish />
          <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
          <ExcludeApp_Data>True</ExcludeApp_Data>
          <publishUrl>$(TargetDir)Publish\Debug\Offline\</publishUrl>
          <DeleteExistingFiles>True</DeleteExistingFiles>
       </PropertyGroup>

    You can see from the build output that aspnet_compiler has been told to build as debug

    Task "AspNetCompiler"
    Task Parameter:PhysicalPath=C:\User_Temp\WebSitePublish\############--1888659248\obj\Debug\AspnetCompileMerge\Source
    Task Parameter:TargetPath=C:\User_Temp\WebSitePublish\############--1888659248\obj\Debug\AspnetCompileMerge\TempBuildDir
    Task Parameter:VirtualPath=/############
    Task Parameter:Debug=True
    Task Parameter:Updateable=False
    Task Parameter:KeyFile=############.snk
    Task Parameter:Clean=True
    Task Parameter:ToolPath=C:\Windows\Microsoft.NET\Framework\v2.0.50727
    AspNetCompiler: C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v /############ -p C:\User_Temp\WebSitePublish\############--1888659248\obj\Debug\AspnetCompileMerge\Source -c -d C:\User_Temp\WebSitePublish\############--1888659248\obj\Debug\AspnetCompileMerge\TempBuildDir -keyfile "############.snk"  

    Monday, April 11, 2016 8:49 AM

Answers

  • Hi pnwright,

    >> Is this expected behaviour for a website publish?

    If you want to know whether the debug or release mode is optimized. I think it’s yes.

    The aspnet_compiler tool determines if it should build a debug or release build depending on the <compilation debug="true|false"> setting in your web.config file.

    You could force this tool to produce a debug or a release output by passing the -d flag. If true, it’s debug result. Instead, it’s release output. But, you should also know that you cannot use the -d option for in-place compilation; in-place compilation honors configuration settings for debugging options.

    For more things, you could refer to below thread to learn more.

    http://stackoverflow.com/questions/2649827/can-you-specify-if-aspnet-compiler-exe-creates-a-debug-or-release-build

    Best Regards,
    Li Wang


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, April 13, 2016 8:12 AM