I am trying to install scaffolding package in VS2010 SP1 in MVC4(aim is to user MvcMailer), here are the command I run
PM> install-package T4Scaffolding
PM> install-package MvcScaffolding
and installing T4Scaffolding gives me this error:
Import-Module : Could not load file or assembly 'file:///path/packages\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
if I use installed it again, it installed but when I use Scaffolding command gives me this error
PM> Scaffolding Mailer.Razor UserMailer subs
The term 'Scaffolding' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:12 + Scaffolding <<<< Mailer.Razor UserMailer subs + CategoryInfo : ObjectNotFound: (Scaffolding:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
I tried uninstalling and deleting the packages and re installing but no luck. I tried update command on both packages but nothing.
When I run import-module "dllpath"
I get same error message i.e.
Could not load file or assembly 'file:///path/packages\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Tried restarting VS after uninstall, install, reinstall all possible but nothing changed.
What I am doing wrong.
EDIT: I have tried to use power shell
PS C:\Windows\system32> import-module "path\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll" Import-Module : Could not load file or assembly 'file:///path\T4Scaffolding.1.0.5\tools\T4Scaffolding.d ll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. At line:1 char:14 + import-module <<<< "path\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll" + CategoryInfo : NotSpecified: (:) [Import-Module], BadImageFormatException + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand
It gives error "This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded." I believe here is the start failing point. Any idea? how to fix this first.
Solved, nothing new in solution but had to do a lot of search, hit and trial, I had VS2010 SP1, default installation. Project was loaded from network drive.
Import-Module : Could not load file or assembly 'file:///path/packages\T4Scaffolding.1.0.5\tools\T4Scaffolding.dll' or one of its dependencies. Operation is not supported.
Above error message comes from VS, because it can't load things from remote source. Fix: Go to your Visual Studio devenv.exe location. i.e. default C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE in devenv.exe.config add line in runtime section i.e. :
<configuration>
<configSections>
</configSections>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0.30319"/>
<requiredRuntime version="v4.0.30319" safemode="true"/>
</startup>
<runtime>
<loadFromRemoteSources enabled="true"/>
I wish error message was more proper at first place but I should also read more.