Exception: Cannot find compilation library location for package ‘Microsoft.AspNetCore’

System.InvalidOperationException: Cannot find compilation library location for package ‘Microsoft.AspNetCore’

Most likely you’ve upgraded your aspnetcore version and you have not cleared the existing files before deployment.

If you’re using Azure DevOps as your build and release server you can enable “Remove Additional Files at destination” on your release step.

AspNetCore Debugging Startup issue in Azure Web App

Whilst upgrading from AspNetCore 2.0 to 2.1, some of the StartUp configuration had changed slightly and part of the upgrade required me to refactor code into the webhost builder. However as a result I didn’t quite do everything and after deploying to azure web app, I was hit with a 502 response. An exception being thrown in main(). This was a problem because it was happening before it could get to my logging initialization and therefore no logging was happening.

So in order to debug Azure Web App AspNetCore startup issues we need to enable stdout logging which throws all exceptions to a log file. This method of logging is unfiltered and gets heavy very quickly. Therefore it is inadvisable to keep it turned on.

Enable STDOUT on Azure Web App

  1. Go to your azure web app in Azure Portal
  2. Open Kudu Console
  3. Using the navigation bar at the top of the page, open Debug console and select CMD
  4. Navigate to folder site > wwwroot
  5. Edit the web.config
  6. Set stdoutLogEnabled to true and stdoutLogFile to \\?\%home%\LogFiles\stdout
  7. Select Save
  8. Make a request to the application url
  9. In Kudu, navigate to the LogFiles folder
  10. Open the new files marked with stdout
  11. When the log file opens, the error is displayed.
  12. you must disable stdoutLogEnabled by setting to false when you are done

 

Source: https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/azure-apps/troubleshoot?view=aspnetcore-2.1#aspnet-core-module-stdout-log

Visual Studio 2017 – Add, Remove or Update DotNetCLITools references – 7th March 2017

Visual Studio release notes as of 7th March release notes state that the DotNetCLITools packages cannot currently be managed by the Nuget Package Manager and must be edited manually in the csproj.

After migrating my current projects, I finally figured out that it wasn’t just me that was struggling to find the place to manage these packages. There’s no intellisense in this area either. Eventually I replaced my pre-release references with the following:

In your csproj file: 

<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
    <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
 </ItemGroup>

This allows visual studio to run the dotnet commands for building, database, bundling and publishing!

Sources: https://www.visualstudio.com/en-us/news/releasenotes/vs2017-preview-relnotes

My Resharper license just expired…renew or not to renew

It’s that time of the year again when the licenses on my third party products start lapsing and I pull out my card to renew for another year. Although having used Resharper for a long time, the line between it and Visual Studio has blurred for me. So instead I’ve decided not to renew and use VS2015 vanilla style.

Off the bat, VS 2015 suddenly became blistering fast. The start up, loading a solution and even the vanilla refactoring tools became almost instant. I don’t seem to remember having this problem when I was using VS 2013 but I have definitely felt it in VS 2015. I am rocking a SSD & i7, I can’t help but feel Resharper was slowing me down which is the opposite reason as to what I bought it for in the first place. Out of the thousands tools it does offer, I felt I was only using maybe 10 of them?

I’ve been off Resharper for a few days and I am actually enjoying the change. Two features I do miss so far is Continuous code analysis using StyleCop and Continuous Testing using dotCover. VS 2017 enterprise edition introduces Live Unit Testing which should hopefully fill this void.

I’m going to give vanilla VS2015 another week or so then I’ll try some of the open source options. I did come across this little gem as a free alternative to the paid providers: http://vsrefactoringessentials.com/

Creating a SQL Alias

To help standardize the connectionstrings across your team’s development machines. You can all use the same sql alias, database name, username and password. The last three are easily configurable however the sql alias isn’t so obvious. Here’s a simple set of instructions to get it working.

My environment at time of this post is Windows 8.1, SQL Server 2014 Express.

  • First you must find the port your server is using through tcp/ip.
  • Open SQL Server Network Configuration
  • Click on the server in question
  • in the right hand pane, right click TCP/IP and select Properties
  • Hit the IP Addresses tab and scroll all the way to the bottom
  • The TCP Dynamic Ports is the port you need to use in the next section.

sqlalias_portconfig

  • Open up Sql Server Configuration Manager
  • Expand SQL Native Client. Choose 32-bit or 64-bit depending on your setup
  • Expend Aliases and create a new entry
  • The port must match the port you found above

sqlserver_sqlalias

Sources: