Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013/2015/2017 profiler adds Not publishable lines in web.config?

Today I was just profiling my WCF application using the profiler of visual studio in Instrumentation mode. Later I needed to a publish to my web server and suddenly I was getting an error saying that Microsoft.VisualStudio.Enterprise.AspNetHelper file path can't be found.

when I reviewed my web.config, I have seen that following lines were added by profiling session.

  <system.web>
<compilation targetFramework="4.0" debug="true" assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, 
Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>


      <runtime>
<generatePublisherEvidence enabled="false"/>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
            <codeBase version="12.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2012.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL"/>
            </dependentAssembly></assemblyBinding></runtime>

<appSettings>
<!--<add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 12.0\Team Tools\Performance Tools\vsinstr.exe"/>-->
</appSettings></configuration>

It is very obvious that it looks for some DLLs on the server but since this path isn't valid on the server as VS isn't installed, it throws an exception. Why is that happening and how to avoid these lines to be added in the web.config? It will be quite cumbersome to remove these lines every time I do a profiling session.

UPDATE: This problem occurs on VS2015 as well. If you start VS profiling tool, It adds a line into the web.config

>   <add
> key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation"
> value="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team
> Tools\Performance Tools\vsinstr.exe"/>    <dependentAssembly>
>               <assemblyIdentity name="Microsoft.VisualStudio.Enterprise.AspNetHelper" 
> culture="neutral"/>
>               <codeBase version="14.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2014.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.AspNetHelper.DLL"/></dependentAssembly>

and if you publish to the server, you will get this error below

Configuration error

Description: An error occurred while processing a configuration file that is needed for this request. Check the specific error details below and modify your configuration file appropriately.

Parser Error Message: File or assembly 'Microsoft.VisualStudio.Enterprise.AspNetHelper, Version = 14.0.0.0, Culture = neutral, PublicKeyToken = "or one of its dependencies not found. The system can not find the file specified.

Source Error:

Application error occurred on the server. Due to the current custom error settings for this application the details of the application error remotely (for security reasons) can be displayed. However, they can be viewed by browsers running on the local server.

Source File: C: \ www \ web.config Line: 52

Load Trace Assembly: can be determined with the following information, why the assembly Microsoft.VisualStudio.Enterprise.AspNetHelper, Version = 14.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a could not be loaded.

WRN: Assembly binding logging is OFF. You can enable logging assembly bind failure, remove the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD) to 1 set. Note: Assembly binding logging error leads to a certain loss of performance. You can turn this feature off, remove the registry value [HKLM \ Software \ Microsoft \ Fusion! EnableLog].

like image 432
Emil Avatar asked May 07 '14 17:05

Emil


2 Answers

I had the issue: the breakpoint cannot be set after using the profiler. The profiler changed the web.config with the above 2 lines. Comment out the key line and change back the compilation line to the original:

<compilation defaultLanguage="c#" debug="true" targetFramework="4.5.2">

the issue is gone, I can set the breakpoint and debug step by step.

like image 168
Jason Avatar answered Nov 10 '22 06:11

Jason


In My case it is the issue with visual studio profiler.It checks for local exe path in web.config. I commented the below 2 lines in web.config and it resolved my issue.

<!--<compilation debug="true" targetFramework="4.5" assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.AspNetHelper, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>-->
<!--<add key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation" value="C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools\vsinstr.exe"/>-->
like image 33
Kurkula Avatar answered Nov 10 '22 07:11

Kurkula