U4-3447 - Nuget package does not install correctly with "Web Site" projects

Created by Matt Brailsford 07 Nov 2013, 11:29:12 Updated by Sebastiaan Janssen 04 Feb 2016, 18:17:41

Is duplicated by: U4-6560

Relates to: U4-7863

Relates to: U4-7899

Before I gate flamed, I know the "best practise" is to use "Web Application" projects (Morten ;), but I often use "Web site" projects for simpler sites as it is much quicker / more flexible to work with. The problem is, the nuget install powerscript has a dependency on a "project path" (when it copies over the files you don't want to include in your project file) which web site projects don't have. If the powerscript is changed to find the path via the projects properties object, both types of projects can be supported.


Matt Brailsford 07 Nov 2013, 12:29:08

Pull request here https://github.com/umbraco/Umbraco-CMS/pull/193

Nicholas Westby 30 Jan 2016, 22:16:02

I had noticed this too. When I attempted to install Umbraco to a website with NuGet, it was doing weird things, like creating a second web.config a folder higher than the website (at the same level as the solution file).

Shannon Deminick 03 Feb 2016, 09:11:10

Some notes on Nuget dubugging, the easiest way to debug paths is with this package: https://www.nuget.org/packages/NuGetPSVariables When you install it it will create log files containing all variable values (it will auto uninstall itself too).

Matt Brailsford 03 Feb 2016, 09:17:38

Forgot to update this, but here is an up to date working pull request https://github.com/umbraco/Umbraco-CMS/pull/738

Shannon Deminick 03 Feb 2016, 09:41:38

PR for review: https://github.com/umbraco/Umbraco-CMS/pull/1090

@matt - i didn't know about that PR you just mentioned, we'll need to review this one first and then see if your other changes are required. If you can provide any feedback on this one that'd be great too since you may know if we've missed something. By my tests this works with both webapps and websites.

Ok, so here's the changes done:

  • Removes Core dependency on Microsoft.Net.Http which includes removing all BCL dependencies - we don't need or use these, these add to the bulk of our product unnecessarily and also causes issues when installing into a website with Nuget because the base BCL nuget install version has issues with Nuget/websites. http://issues.umbraco.org/issue/U4-7863
  • Updates the build.bat to remove the BCL related logic - we don't need that anymore
  • Updates install.core.ps1 to not forcibly remove the DLLs that are Nuget references that we ship with during install
  • Fixes install.ps1 and install.core.ps1 to handle paths correctly regardless of whether it's a website or webapp proj.
  • Updates install.ps1 to always copy over umbraco files, not only when upgrading. This ensures the files are copied regardless of whether the user builds or not, this ensure things also work with websites properly and should now allow for normal package restore functionality to ensure the files exists where they need to without building.
  • Updates readme's to not have to indicate to build - since the files are already there
  • Creates an uninstall.ps1 - this will remove files that should no longer exist when uninstalling Umbraco: ** the relevant app browser files ** the App_Data\NuGetBackup files ** the App_Data\Temp files ** the App_Data\packages files ** the /umbraco and /umbraco_client files
  • Creates an uninstall.core.ps1 to remove: ** the DLLs that umbraco ships with ** the App_Data\NuGetBackup files
  • Creates a web.config.uninstall.xdt to remove all umbraco related settings

Matt Brailsford 03 Feb 2016, 09:52:11

Sounds about right to me. The biggest thing has always been the file paths as they have historically used the "project" object within the ps1 scripts, which for a website project doesn't exist. My PR basically uses other means to gather the correct paths which works for both. The rest, while looking complex, is basically to do handle injecting targets, which had to be done by hand, rather than using a helper that was used previously.

Matt Brailsford 03 Feb 2016, 09:54:15

PS I'll try and test the PR you reference if I have a spare minute

Sebastiaan Janssen 03 Feb 2016, 09:56:40

The PR will build in the next ~20 minutes, output will appear here: https://ci.appveyor.com/project/Umbraco/umbraco-cms-hs8dx/build/2811/artifacts

Sebastiaan Janssen 04 Feb 2016, 18:17:33

@matt I know I keep rejecting you (sorry!) but I didn't have time to dive into what your MSBuild stuff is doing exactly. I've created U4-7899 and maybe maybe I'll get a chance to look at it for the final release!

Priority: Normal

Type: Bug

State: Fixed


Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:

Sprint: Sprint 8

Story Points: