title: .net core 2 angular 5 prerender failed
body: <p>I'm getting the following error:</p>
  
  <blockquote>
    <p>NodeInvocationException: Prerendering failed because of error: ReferenceError: window is not defined</p>
  </blockquote>
  
  <p>I have followed the following documentation from microsoft themselves:
  <a href="https://docs.microsoft.com/nl-nl/aspnet/core/client-side/spa/angular?view=aspnetcore-2.0&amp;tabs=visual-studio" rel="nofollow noreferrer">https://docs.microsoft.com/nl-nl/aspnet/core/client-side/spa/angular?view=aspnetcore-2.0&amp;tabs=visual-studio</a></p>
  
  <p>So the prerendering gets triggered but it fails because on the server side window does not exist ofcourse.</p>
  
  <p>Now i have seen fixes for the older angular template from Visual Studio which came with Angular 4. The one from the documentation has Angular 5 and is build up a little different. So I have found fixes but they do not work because I do not have an index.cshtml. In the new template you get a normal index.html:</p>
  
  <pre><code>    &lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
    &lt;title&gt;Test/title&gt;
    &lt;base href="/"&gt;
  
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;link rel="icon" type="image/x-icon" href="favicon.ico"&gt;
    &lt;script src="https://use.fontawesome.com/93acba991a.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
    &lt;app-root&gt;Loading...&lt;/app-root&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The solution for the first project was :</p>
  
  <blockquote>
    <p>replace the "asp-prerender-module" with "asp-ng2-prerender-module"</p>
  </blockquote>
  
  <p>As you can see i do not have a asp-prerender-module in there, and changing it to "asp-ng2-prerender-module" does not work for me. I'm using the @agm/core package which gives me this error, but i heard multiple packages suffer from this problem. I hope anyone has a fix for this issue.</p>