NuGet execution policy errors when installing MvcScaffolding package

Question:

I’m using Visual Web Developer Express 2010, Windows XP, and using ASP.NET MVC4 RC in a project. I have NuGet v2.0.30619.9119 installed.

I’m now trying to install the MvcScaffolding package via NuGet Package Manager Console. I get the following errors:

Because the init scripts aren’t being executed after the install, the MvcScaffolding package is not installed correctly and the scaffold command is not recognised.

I don’t know what to do about these code signing issues. Here are the current security settings:

Can I change the Process scope to be Unrestricted? If so, how? Running Set-ExecutionPolicy in the NuGet console does not work:

I’ve also tried doing all of this as an Administrator and that didn’t help either.

Any advice or ideas would be much appreciated.

UPDATE

I can set the process execution policy in NuGet like this:

But when I restart Visual Web Developer, the setting is forgotten and I still get an error as it keeps trying to execute the init.psl files

How can I change the execution policy permanently?

Answer:

OK, I have MvcScaffolding installed correctly now.

I had to first bypass all security in NuGet:

But when I restart Visual Web Developer I still get those same PowerShell errors todo with the NuGet running init.pls on startup.

I’ve worked out that it’s because I was storing my project on a network drive. Apparently PowerShell won’t execute scripts from the network drive by default.

I tried using CasPol to change the security settings, but couldn’t get it to work. I gave up when I saw other people couldn’t get VS to work with mapped drives as well:

CAS not working for VS2010 mapped drive

Anyway, I just have my project local now, and MvcScaffolding is installed and working.

Source:

NuGet execution policy errors when installing MvcScaffolding package by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply