Monthly Archives: October 2015

Diving Into ASP.NET 5 Beta 8? Don’t forget the web tools!

Some developers have been working closely with the evolving ASP.NET 5. Not me. I play with it once in a while. My last time was in the spring with the beta 4. Beta 8 was just released and I was working on creating a Web API. I had two projects in my solution. One was using the ASPNET5 Web API template from Visual Studio 2015.

image

The other used the ASP.NET 5 Class Library project template.

image

The Web API project had a reference to the class library project.

When I attempted to build the solution I got the following two errors that were coming from the Web API project:

CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Users\jlerm\.dnx\packages\System.Collections\4.0.10\ref\dotnet\System.Collections.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Collections.dll'. Remove one of the duplicate references.
CS1703  Multiple assemblies with equivalent identity have been imported: 'C:\Users\jlerm\.dnx\packages\System.Threading\4.0.10\ref\dotnet\System.Threading.dll' and 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\System.Threading.dll'. Remove one of the duplicate references.

I won’t bore you with everything I tried to sort this mess out. I finally did find a hack but then ran into another problem at run time — because of changes to web hosting — that was what eventually helped me find the solution to the first problem.

It turns out that the templates were my problem. There are some changes with beta 8 that resulted in the need for new project templates for Visual Studio 2015. They are contained in the ASP.NET and Web Tools 2015 (Beta 8) update for Visual Studio 2015.

You can download them at http://www.microsoft.com/en-us/download/details.aspx?id=49442.

Visual Studio 2015, Command Prompt & Powershell ExecutionPolicy

Just a hint in case you run into this problem that took a few days to discover the pattern.

I have the Productivity Power Tools 2015 installed as an extension to VS2015. These are from Microsoft and there are a ton of features in there that I can’t live without.

With this I can right click on a solution or project in Solution Explorer and open a command prompt at the relevant path.

image

I mostly use this feature to get to posh-git to run some git commands.

posh-git is a PowerShell enhanced environment for the git command line.

image

There are plenty of other reasons you may want to use PowerShell interactively with Visual Studio. Working with ASPNET5 apps is a very good reason.

The problem I encountered was that occasionally, I would get into PowerShell but my Execution-Policy was, for some reason, Restricted, so I couldn’t trigger posh-git.

image

I finally figured out how to ensure I entered the command prompt with my normal Unrestricted ExecutionPolicy.

Be sure to open the Package Manager Console in Visual Studio first. That starts up Powershell with the correct policy. Then when you open your command prompt, you are good to go.