issue opening projects in blend after having set "enable nuget package restore"


In all my source control enabled work I set the <solution> | "enable nuget package restore" option that prevents $(SolutionDir)\packages binaries from being included in source control checkins. Applying this setting results in the line <Import Project="$(SolutionDir).nuget\nuget.targets" /> automatically being inserted into any solution contained projects that have had nuget packages installed.

Once that import setting is in place selecting <win8 html/xaml windows store project> | "open in blend" fails and generates the an error dialog stating it was unable to find $(ProjectDir).nuget\nuget.targets. Presumably this is because it is the <app>.jsproj/csproj that "open in blend" is trying to open and not the <solution>.sln in which case the import statements $(SolutionDir) reference is not set.

If you try to set tht import statement path to use a relative reference, e.g. <Import Project="...nuget\nuget.targets" />, that doesn't work because it appears the nuget extension resets it back to the original path entry when you reload the project or visit manage nuget packages.

Current work arounds for this have been to:
  1. use the file explorer accessed <solution>.sln | open with blend option which is not desirable as it opens everything in solution and not just the project you care about, also it doesn't allow you to do this from vs12 loaded solution view
  2. modify the jsproj/csproj nuget.targets import statement to include the following condition statement. It seems that doing this doesn't result in nuget extension resetting that import statement value the next time it loads project or checks for that statement when you visit manage nuget packages probably because the Project attribute setting is left unchanged.
    <Import Project="$(SolutionDir).nuget\nuget.targets" Condition="'$(BuildingInsideVisualStudio)'=='true'" />
I'm not sure how relevant any nuget package management story is in the context of blend project work, I think it has no bearing, in which case perhaps it makes sense to have nuget extension start inserting import statement with some flavor of the condition statement show above included. This would save developers from having to add that manually in order to restore support for vs12 | <solution> | <win8 html/xaml windows store project> | open in blend feature.


JeffHandley wrote Nov 29, 2012 at 9:58 PM

We are looking to re-engineer package restore at some point such that it doesn't rely on the targets file implementation as it does today. We will take Blend scenarios into account at that time.