title: How to reference class library with cshtml files to azure function
body: <p>So I have the following projects in one solution..</p>
  
  <ul>
  <li>'MyAFProject', a QueueTrigger function needs to send emails.</li>
  <li>.net-core project called'MyServices' that is referencing the 'RazorClassLib.RazorViewRenderer'</li>
  <li>.net-core project called 'RazorClassLib' that contains all the templates and a function called 'RazorViewRenderer'</li>
  </ul>
  
  <p>In short,  MyAFProject calls MyServices, and MyServices call RazorClassLib.</p>
  
  <p>The problem:
  My MyAFProject calls 'MyServices' to do some tasks which involves rendering templates but it cannot find the templates. I have added the 'RazorClassLib' as a reference on MyAFProject, however, the same problem occurs.</p>
  
  <p>I tried:
  Adding the views folder from RazorClassLib on MyAFProject root folder which works sometimes.. but still produces error like </p>
  
  <p><code>azure function error CS0234: The type or namespace name 'Razor' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?)</code></p>
  
  <p>I have also added this on MyAFProject file</p>
  
  <pre><code>&lt;Target Name="PostBuild" AfterTargets="PostBuildEvent"&gt;
      &lt;ItemGroup&gt;
        &lt;OutputFiles Include="$(OutDir)RazorClassLib.Views.*"&gt;&lt;/OutputFiles&gt;
        &lt;OutputFiles Include="$(OutDir)MyAFProject.deps.json"&gt;&lt;/OutputFiles&gt;
      &lt;/ItemGroup&gt;
  
      &lt;Move SourceFiles="@(OutputFiles)" DestinationFolder="$(OutDir)bin\" OverwriteReadOnlyFiles="true"&gt;&lt;/Move&gt;
    &lt;/Target&gt;
  </code></pre>
  
  <p>What is the possible solution to this problem? All I need is to be able to call a method inside my azure function that does view rendering, but it gives me 'cannot find view file' errors and if it does, I still get mvc,razor,linq <code>does not exist in the namespace</code>.</p>
  
  <p>Note that my service and razorclasslib is fully functioning except when I use it in my azure function. Been stucked with this problem for few days already. A little help will be much appreciated.</p>