Skip to content

Instantly share code, notes, and snippets.

@pakrym
Last active October 13, 2017 16:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pakrym/a03828280eaf216a2623af154426a54a to your computer and use it in GitHub Desktop.
Save pakrym/a03828280eaf216a2623af154426a54a to your computer and use it in GitHub Desktop.

Setup

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <clear />
    <add key="Local" value="d:\localnuget" />
    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

Razor referencing SR: 2.0.2-servicing-25728-02 and 2.0.3-rtm-101

  1. dotnet new razor
  2. Open in VS
  3. Run
  4. VS AI works, deps file does not contain AI
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeFrameworkVersion>2.0.2-servicing-25728-02</RuntimeFrameworkVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3-rtm-101" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
</Project>

Razor referencing SR: 2.0.2-servicing-25728-02 and 2.0.0

  1. dotnet new razor
  2. Open in VS
  3. Run
  4. VS AI works, deps file contains AI
<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeFrameworkVersion>2.0.2-servicing-25728-02</RuntimeFrameworkVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
</Project>

Razor referencing SR:2.0.0 and 2.0.3-rtm-101

  1. dotnet new razor
  2. Open in VS
  3. Run
  4. VS AI works, deps file does not contain AI

ANC 2.0.0 version of HS is loaded as expected:

c:\program files\dotnet\store\x64\netcoreapp2.0\microsoft.aspnetcore.applicationinsights.hostingstartup\2.0.0\lib\netcoreapp2.0\Microsoft.AspNetCore.ApplicationInsights.HostingStartup.dll

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3-rtm-101" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
</Project>

Razor referencing SR: 2.0.0 and 2.0.3-rtm-101 and direct AI reference

  1. dotnet new razor
  2. Open in VS
  3. Run
  4. VS AI works

VS injects AI hosting startup without DEPS and causes hosting startup exception:

{OriginalFormat}: Hosting startup assembly exception
Application version: 1.0.0.0
AspNetCoreEnvironment: Development
CategoryName: Microsoft.AspNetCore.Hosting.Internal.WebHost
DeveloperMode: true
Event time: 10/12/2017 11:59:48 PM
Exception: System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.ApplicationInsights.HostingStartup failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
   --- End of inner exception stack trace ---
Exception type: System.InvalidOperationException
Message: Hosting startup assembly exception
Problem ID: System.InvalidOperationException at 
SDK version: aspnet5c:2.1.1
Severity level: Critical

Stack Trace
System.InvalidOperationException: Hosting startup assembly exception

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
    at  System.Reflection.RuntimeAssembly._nLoad
    at  System.Reflection.RuntimeAssembly.InternalLoadAssemblyName
    at  System.Reflection.Assembly.Load
    at  Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices


<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3-rtm-101" />
    <PackageReference Include="microsoft.applicationinsights.aspnetcore" Version="2.1.1" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
</Project>

Razor referencing SR: 2.0.2-servicing-25728-02 and 2.0.3-rtm-101 and direct AI reference

  1. dotnet new razor
  2. Open in VS
  3. Run
  4. VS AI works

VS injects AI hosting startup without DEPS and causes hosting startup exception:

{OriginalFormat}: Hosting startup assembly exception
Application version: 1.0.0.0
AspNetCoreEnvironment: Development
CategoryName: Microsoft.AspNetCore.Hosting.Internal.WebHost
DeveloperMode: true
Event time: 10/13/2017 12:10:40 AM
Exception: System.InvalidOperationException: Startup assembly Microsoft.AspNetCore.ApplicationInsights.HostingStartup failed to execute. See the inner exception for more details. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks, IntPtr ptrLoadContextBinder)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, IntPtr ptrLoadContextBinder)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
   at Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices(AggregateException& hostingStartupErrors)
   --- End of inner exception stack trace ---
Exception type: System.InvalidOperationException
Message: Hosting startup assembly exception
Problem ID: System.InvalidOperationException at 
SDK version: aspnet5c:2.1.1
Severity level: Critical

Stack Trace
System.InvalidOperationException: Hosting startup assembly exception

System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.ApplicationInsights.HostingStartup, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
    at  System.Reflection.RuntimeAssembly._nLoad
    at  System.Reflection.RuntimeAssembly.InternalLoadAssemblyName
    at  System.Reflection.Assembly.Load
    at  Microsoft.AspNetCore.Hosting.WebHostBuilder.BuildCommonServices



<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeFrameworkVersion>2.0.2-servicing-25728-02</RuntimeFrameworkVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.3-rtm-101" />
    <PackageReference Include="microsoft.applicationinsights.aspnetcore" Version="2.1.1" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
</Project>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment