Visual Studio For Mac Package Manager Console

As mentioned in a previous post, I have struggled to install Umbraco using 7.2.1/7.2.4 and Visual Studio 2013 (VS2013).

As a developer my requirement is to add content management to an existing MVC project, or to start a new MVC project and give the users the option of content management so on the face of it Umbraco is a pretty good fit. Umbraco is more intrusive to Visual Studio than it could be in my opinion, because it overwrites the global.asax and uses its own compiled version for routing configuration etc. Not exactly an open system. However it does install correctly on VS2012. I have used MVC 4 and Visual Studio 2012 on .NET Framework 4.5.1.

This is part of 2 posts, the second post covers Deploying a Visual Studio 2012 project to Azure – this are follow on steps once you have completed all the steps listed in this post.

Package Manager For Visual Studio

PowerShell nuget package manager (the one from Visual Studio) has cmdlet's name collisions with PowerShellGet (PS package manager), which you run in PowerShell on OS X. They essentially provide the same functionality for different scopes (project vs. The Visual Studio Package Manager Host is not currently supported macOS using the PowerShell beta and thus trying to install/init EntityFramework.psm1 will fail as running powershell will result in a ConsoleHost and thus trying to run Import-Module on the EntityFramework PS module will fail.

Installing NuGet Using the Package Manager Console Step 1: Select Tools > NuGet Package Manager > Package Manager Console It will open the console at the bottom of the window. I am trying to add a Nuget package, but I cannot open the package manager dialog. In the 'Project' menu and the 'Add' menu of the menu produced by right-clicking on projects, the Nuget related options are greyed out. Package Manager Console not found in Tools menu?? I am using Visual Studio 2010. I need to run a command in it Install-Package Facebook to avail Facebook SDK in C#.NET. The NuGet Package Manager Console is built into Visual Studio on Windows version 2012 and later. (It is not included with Visual Studio for Mac or Visual Studio Code.) For example, finding and installing a package is done with three easy steps: Open the project/solution in Visual Studio, and open.

Here are the steps:

Step 1: Create a C# or VB Web project in Visual Studio 2012.

Choose your name and Click OK.

Step 2: Choose Empty Project
Step 3: Remove your global.asax and web.config

I am not 100% convinced that this step is necessary, however I did it anyway during my install as some posts on the internet related to Visual Studio and Umbraco recommended it. Its probably a good idea to remove the files in the App_Start folder and also compile the project at this point (a better way if you have any concerns at this point is to go into Nuget and remove all packages).

Visual studio for mac package manager console create

Visual Studio For Mac

Step 4: Disable Resharper if you have it installed

Again based on a recommendation I have read about. Go to Tools, then Options then Resharper as shown below:

Step 5: Add Umbraco using Nuget Package Manager Console

Go to Tools, then Package Manager, then Package Manager Console and enter the following command (N.B. omit the version part to get the latest version):

2
install-packageumbracocms-version7.2.1

Any errors at this stage – remove umbracocms and all other packages in Nuget and try again. Don’t forget to re-enable Resharper if you suspended it.

Step 6: Create a SQL/Server Database

You should create a SQL/Server database on your local machine:

Visual Studio For Mac Package Manager Console Uninstall

You also need to set up a user for this database:

Creating a user in SQL/Server 2012

Step 7: Build and Run the Project to Install Umbraco

Now you have set up Umbraco in the project, you need to set up Umbraco in its database for your website.

Switch back to Visual Studio 2012 and Build and Run the project. If the following prompt comes up enter as desired (the publish option should transform debug out of the web.config in any case):

Important: on the following page enter your details and click Customize. Do not click Install unless you want all the default options.

On this page, you should enter the details of your SQL/Server database and user you just set up, then click Continue, to well, continue…

You should choose “No thanks, I do not want to install a starter website”, unless you are doing this for the first time and want to have a play.

Umbraco then “whirrs” for a bit (or maybe its just my computer) and then takes you into the Umbraco admin area. You are now ready to go and set up your own template. However, I’m going to take you straight into deploying this empty website to Azure in my next post.

Visual Studio For Mac Package Manager Console

At this point, I think I checked the Add Item options in Visual Studio about 1,000 times, just to marvel at the “Add Controller” option, unable to believe my eyes. The reason? Following exactly the same steps in Visual Studio 2013 results in the scaffolding options being absent, with no way to get them back for that project. Not really good enough given that VS2013 has been around for a couple of years.

To deploy this project to Azure, please refer to my next post on Deploying a Visual Studio 2012 website to Windows Azure. Having just created an Umbraco project, there are a few additional things you should be aware of:

  1. You need to ensure that all the correct files are included in the project, because by default, many are not. More or less everything apart from the usual bin, obj and packages folders should be deployed. So to do this, click Show All Files and right click and choose Include in Project as appropriate. If you don’t do this your project will not work when it publishes because it will not be complete.
  2. You should remove the umbracoinstall folder within the solution. It is no longer needed and should not be deployed up to the web.
  3. You might like to add a robots.txt file before you deploy. There are many ways to do this, but I just added a text file to the Visual Studio project with some suitable lines in it.
  4. If you get errors when you deploy for the first time, you can use WebMatrix to change your deployed Web.Config to set CustomErrors=”Off” rather than “RemoteOnly”. This will allow you to see the YSOD (yellow screen of death). In my case, it was due to missing dlls – from an Umbraco package that I had installed as part of my theme. Visual Studio Publish doesn’t know about these. So I manually copied this DLL into my bin folder.
  5. Once you have deployed for the first time, its very important to ensure that any .config files in App_Data are NOT deployed subsequently. This is because these are data files that hold some of the content for the site. The reason why I deployed these the first time was because I had installed a theme locally before deploying so I wanted my sample content up. So I set build action to “None” for these files.

Visual Studio Nuget Package Manager

Update: After following the steps in this post, you may like to review which files are in the project and also if they are added correctly to your source control system. I usually use SVN, and some work is always required in this respect. In particular Umbraco will not add files from a template into Visual Studio automatically, so you have to show all files and then include the files you would like in the project by right clicking and choosing “Include in Project”.

Visual Studio For Mac Download


About Phil

I have been working as a software developer since 1983. This blog could have been called 'From Fortran 77, C and Cobol to C# in 20 (not so) easy years', but it doesn't sound quite right somehow. Besides I'm talking about what's happened since 2003, not before!