Nuget gives the error "ps1 cannot be loaded because running scripts is disabled" - asp.net-mvc

I have a new empty MVC 5 project, and I try to install Nuget packages.
When I insert in the Nuget Console the command :Update-Package I got the following asnwer:
File E:\WebApp\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\tools\uninstall.ps1 cannot be loaded because running scripts is
disabled on this system. For more information, see about_Execution_Policies at http://go.microsoft.com/fwlink/?LinkID=135170.At line:1 char:3
+ & 'E:\WebApp\packages\Microsoft.CodeDom.Providers.Dot ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
then I start to install some new packages and got again this message:
WebApp\packages\Modernizr.2.8.3\tools\install.ps1 cannot be loaded because running scripts is disabled on this system
I saw some posts related with this message, but not related with MVC projects.
My question is:
Why I get those messages?
What can I do to fix this issue?
This issue, can appear on the server where my application will run? Some scripts to not run as expected?

I guess the specific package you are trying to install needs to run a Powershell script and for some reason, Powershell execution is disabled on your machine.
You can search google on "how to enable Powershell" for a complete guide but generally, it goes like this:
Open up a Powershell command window (just search for Powershell after pressing windows start button)
Check out current restrictions by typing Get-ExecutionPolicy
Enable PowerShell by typing Set-ExecutionPolicy remotesigned
This issue does not affect the server you are planing to install your application on.

If you encounter this installing NuGet packages from Visual Studio Package Manager Console, run Visual Studio as Administrator.

In case anybody finds this on Google and this happened to you, I suggest you first try restarting Visual Studio, particularly if the Package Manager Console has worked for you before. In VS 2019, I've noticed that, if I leave it in the background while it's loading, sometimes it'll throw that error.
For me, restarting Visual Studio and leaving it in the foreground until the Package Manager Console finished initializing solved the issue. Note that running it as administrator was not necessary.

Translation of the image text would be somewhat: This certificate has been revoked from its key store.
Certificate on my init.ps1 has expired - thus RemoteSigned will not do. For that package version to work, it would need to be set to ByPass or Unrestricted. Personally, i would not recommend doing this...
-- EDIT --
I went ahead and updated the package and found they have resigned a new cert for v 1.0.2. Issue following in NuGet console for fix:
Update-Package Microsoft.CodeDom.Providers.DotNetCompilerPlatform

open your power-shell as administration and type
Get-ExecutionPolicy
Expected result RemoteSigned
Set-ExecutionPolicy remotesigned
if it does not work, try Powershell run in administrator

I ran into a similar issue building a project and found that you MAY have to set the execution policy to remoteSigned (as others have mentioned) in BOTH powershell (x86) and powershell (x64). I was running the x64 version as administrator and Get-ExecutionPolicy returned "remoteSigned" but the x86 version hadn't been updated. Just something to try if the above answers don't work for you.

This should work
open your power-shell as administration and type
Get-ExecutionPolicy
Expected result RemoteSigned
Set-ExecutionPolicy remotesigned
Enjoy

A quick to fix this error when using Package Manager Console without VS restart and/or running as Admin is to remove the restriction for current user:
Set-ExecutionPolicy remotesigned -scope CurrentUser

Related

QuickBooks 2019 Desktop Accountant Silent Install

We've been trying to deploy QuickBooks 2019 through SCCM for a while now (using a transform file since Intuit refuses to implement any sort of command line switches for whatever reason). The normal method for deployment using applications or packages hasn't worked. I'm using msiexec in a batch file to run the install, but it doesn't seem to work with "/qb" specified. If I remove the "/qb", the command runs and the install works just fine, but that obviously eliminates the silent part, which is the whole point of attempting this. Any advice on what else to try to get this working is appreciated. Here's the command as it is right now:
msiexec /i "%~dp0QBooks\QuickBooks.msi" TRANSFORMS="%~dp0QBooks.mst" /qb
Try the /qn instead of the /qb.
Would be willing to share your transform file or share what needs to be changed on the transform file?

Why does Erlang run configuration in Eclipse IDE stop at 57%?

I am starting out Erlang in Win 7 64 bit box and I was able to use Erlang IDE just fine and since I am used to Eclipse I wanted to use Erlide with Eclipse. I am following running project document on erlide I was able to follow along. (Except step 41, Where it is talking about adding something to 'Main tab' and in my case it shows as 'Erlang', but options they are same) When I run the 'new configuration' on the HelloWorld example it runs and stuck at 57%.
I did install Erlang on my PC and installed it in a directory without space and it does shows up on my installed runtime in Eclipse.
When I run I do not see 'Eclipse IDE' like I saw when I was running Scala IDE in eclipse.
I did enter a dummy cookie name just in case if that is the problem
I tried running 'erl -name foo' to make sure node is able to run and it did.
Is there anything I need to check?
Thanks
Try first this:
* delete the configuration you created
* open a file in your project, right-click in it and choose Run as -> Erlang application
This will create a configuration that should work. You should see a console opening, where you can interact with the Erlang node.
If that is not happening, please go to window->preferences->erlang->report problem and create a report. Attach it to an issue at https://github.com/erlide/erlide/issues or send it to erlide_bugs#lists.sourceforge.net
I have the same problem on Win 7 - 64bit.
Problem: After some very first times build and run successfully, then eclipse couldnt run anymore. Restart Eclipse won't help.
Solution: Restarting the computer, and plz remember to Build Project before running it.

Ejabbered installation issue for Windows

I tried to install ejabberd 2.1.11 for windows on my Windows system, but at the final stage of installation it given post installation error. Couple of some of the last lines in the intallation logs says:
***Executing final installation script
Error executing post installation script
C:\Program Files (x86)\ejabberd-2.1.11\bin\postinstall.cmd
./ejabberdctl: erl.exe: can't execute: (14001) Error 14001
Creating Uninstalle***r
Though the shortcuts are created on the system but trying to start the server gives following error
./ejabberdctl: erl.exe: can't execute: (14001) Error 14001
The VC++ 2008 is already installed on the system. While searching I found the following post on stackoverflow:
How to install ejabberd community version on Windows XP?
But this too did not help. Has anyone else encountered the same scenario? Your suggestion would be greatly appreciated.

The term 'scaffold' is not recognized as the name of a cmdlet, function, script file, or operable program

I've been developing an ASP.NET MVC 4 project for a while now and I've been using the "MVCScaffolding" package successfully but a few days ago I noticed that when creating a new controller for example the item for MVCScaffolding does not show up anymore. trying to run the scaffold command will also result in the following error:
The term 'scaffold' 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:9
+ scaffold <<<<
+ CategoryInfo : ObjectNotFound: (scaffold:String) [], CommandNotFoundException
I've noticed that this problem has been mentioned several times on this page but no solutions have been provided.
Also the "MVCScaffolding" package could be used by other projects under the same environment in different solutions but not the same solution so I guess it is something specific to this solution. I've already tried uninstalling and reinstalling the packages manually or by the following commands, reinstalling nuget and restarting VS an windows several times :) ;
Uninstall-Package MvcScaffolding -RemoveDependencies
Install-Package MvcScaffolding
What I'm looking for is first and obviously how to resolve this specific issue and second, In general in such cases where should one be looking for in order to start debugging the problem? how does the command prompt determines whether or not a command is available?
Thanks in advance.
MVC Scaffolding defines the 'scaffold' command alias when a solution is opened in Visual Studio. The T4Scaffolding.Core NuGet package is the one that actually calls Set-Alias to do this in its init.ps1. You could check that the init.ps1 for the T4Scaffolding NuGet package is being run.
I know this post is really old.. but for those of you who are still facing this problem with VS2013, Please try the following:
Uninstall-Package T4Scaffolding <-- If you have already used PM Console To Install it..
Install by right clicking "references" -> Manage Nuget Packages -> Search for T4Scaffolding and install it from there..
By doing the above steps it worked like a charm for me
My Problem was solved by adding T4Scaffolding.Core through the NuGetPackage Manager. (version 1.0.8)

Windows x64 RabbitMQ install error with Erlang environment var (ERLANG_HOME)

I'm ask/answering this question because it hung me up & it's likely someone else will have the same problem.
Install of RabbitMQ x64 v2.8.6 on Windows Server 2008 x64.
After Erlang install using default install location to C:\Program Files\erl5.9.2, I'm attempting to start the server via running the rabbitmq-service.bat. Fail:
Please either set ERLANG_HOME to point to your Erlang installation
or place the RabbitMQ server distribution in the Erlang lib folder.
Problem is the .bat file does not have the correct subpath. with 5.9.2 (R15B02) version of erlang. My ERLANG_HOME directory is set correctly, but the script does not use it correctly for this version of Erlang, which, it appears to this Erlang noob to have a new subdirectory called "erts-5.9.2" which is causing the problems. Maybe someone intimate with these scripts can describe how to make this work correctly without the hack workaround I'm about to describe?
1- Set environment variable:
Variable name : ERLANG_HOME
Variable value: C:\Program Files (x86)\erl6.4
note: don't include bin on above step.
2- Add %ERLANG_HOME%\bin to the PATH environmental variable:
Variable name : PATH
Variable value: %ERLANG_HOME%\bin
This works well.
There are several RabbitMQ control .bat files on windows. Every one you use needs to get changed to reflect the Erlang path correctly. In this example, I'm editing the rabbitmq-server.bat because it's one of the easier ones... any of the .bat files you want to run will need this hack to get them to work, with the rabbitmq_service.bat file being the most involved to adjust.
editing that rabbitmq_server.bat file, you can see on about line 48 or so there's a check to see if the erl.exe is found, but the path isn't correct:
if not exist "!ERLANG_HOME!\bin\erl.exe" (
that path does not match the file structure for the 5.9.2 version of Erlang. I fixed this by simply removing this path check from about line 48 to 58, then, where the .bat actually makes a call to the erl.exe on about line 129 which reads:
"!ERLANG_HOME!\bin\erl.exe"
I simply hardcoded the path to my erl.exe:
"C:\Program Files\erl5.9.2\erts-5.9.2\bin\erl.exe"
With the pathing correct, the rabbitmq .bat files will run.
I had the similar issue, modifying ERLANG_HOME in .bat files did not work. Then I tried echo %ERLANG_HOME% in command prompt, that did not print the environment variable value(I could see that ERLANG_HOME environment variable has been created under advance system settings), that lead me to believe that I need to restart server for 64 bit installation of Erlang. After rebooting server, It worked like a charm. I hope this helps someone.
Just to share an up-to-date answer as of 2019: On Windows Server 2019, after setting up the environment variable, a restart is required to solve the problem.
I got into same kind of problem.
I solved it by doing three changes as given below.
Update Path variable "ERLANG_HOME" : "C:\Program Files\erl8.0" in Environment Variables.
Upadte "Path" variable "Path" : ";%ERLANG_HOME%\bin;"
Give urself FULL CONTROL permissions over "Program Files" in C drive.
It worked for me in this way.
This problem still occurs in Erlang 18.3 (erl7.3) and RabbitMQ 3.6.9 on Windows when upgrading from any older version of RabbitMQ to version 3.6.9. The solution as already stated here is to manually set ERLANG_HOME with 'setx -m ERLANG_HOME "C:\Program Files\erl7.3"' before starting the service.
What happens is that the RabbitMQ 3.6.9 installer removes the environment variable ERLANG_HOME from the system while removing the older version of RabbitMQ. Then, when it proceeds to the installation step, it does not put back the ERLANG_HOME variable. Then, the batch files that start up RabbitMQ cannot find Erlang. They try to find Erlang's home directory using "where.exe" but it always fails after an upgrade.
RabbitMQ's installer also does not kill all of the Erlang background processes, causing many of its files to be undeletable due to the Windows "file in use" problem. This leaves behind "files in use" in %APPDATA%\RabbitMQ and "C:\Program Files\RabbitMQ." These processes are "erl.exe," "erlsrv.exe," and "epmd.exe." The RabbitMQ installer should taskkill these processes after shutting down the RabbitMQ Windows service.
RabbitMQ is rather clunky on Windows.
Download Erlang or OTP - Only one Version of OTP should be installed
Download RabbitMQ installer
Install both exe file as Administrator
Set class path for Erlang. (Setting classpath is a bit troublesome, so follow these steps)
Set a new path with name ERLANG_HOME and value C:\Program Files\erl-23.1 (do not copy bin folder here)
Edit System "path" and add %ERLANG_HOME%\bin
Go to Start - Open rabbitmq command promt and run
rabbitmq-plugins enable rabbitmq_management
Navigate to localhost:15672
Use guest/guest to login
Interesting that this worked for you. There is record of a two bugs in Erl5.9.2 that cause an incomplete installation where %ERLANG_HOME%\bin is not installed.
Either of
* Installed 64bit erlang on 32bit machine
* "The program can't start because MSVCR100.dll is missing from your computer."
https://groups.google.com/d/topic/erlang-programming/wGtFLzapiQ0/discussion
Try 5.9.1 or any other version. They also mention making the future versions of the installer alert you if it fails.
I just had the same problem mentioned here. I installed otp_win64_R15B02 on a Windows 7 machine and everything worked perfectly, but I used the same installer on a Windows 2008 server and the bin directory was not created. I then uninstalled otp_win64_R15B02 and downloaded the otp_win64_R15B02_with_MSVCR100_installer_fix and the bin directory was created.
I suspect the reason it worked on my Windows 7 system is that I have Visual Studio installed and the required libraries were already available which allowed the otp_win64_R15B02 installer to work correctly.
Oh, and if you're installing Erlang to run RabbitMQ the RabbitMQ install will succeed with the broken installer but installing otp_win64_R15B02_with_MSVCR100_installer_fix after RabbitMQ will not work, just un-install and re-install RabbitMQ to resolve this.
Just give C:\Program Files\erl10.6\ not C:\Program Files\erl10.6\bin\erl.exe in the environment variable. If you open the server.bat file I came to know the issueenter image description here
I think this is encoding issue on windows.I see a correct value but I write echo %ERLANG_HOME% on console the value come with question mark. These steps fix it.
1.go environment variable window
2.edit ERLANG_HOME item
3.copy the value, open notepad and paste there
4.copy again on notepad and paste to edit window
5.apply and exit window
6.close command line tools and reopen
7.run rabbitmq bat file.
I solved it in a quick and dirty way,without naming path variables
I've opened the bat file and replaced every occurrence of
!ERLANG_HOME!\bin\erl.exe
with hard coded path for example might be diffrent path for you because of diffrent version
C:\Program Files\erl10.3\erts-10.3\bin\erl.exe
and replaced
%RABBITMQ_HOME%\escript\rabbitmq-plugins
with
C:\Program Files\RabbitMQ Server\rabbitmq_server-3.7.14\escript\rabbitmq-plugins
Even I was this problem. The issue was the environment variable ERLANG_HOME=c:\Program Files\erl9.0 which was never existed.
I cross checked the path. The correct path was c:\Program Files\erl9.3.
After correcting the
ERLANG_HOME=c:\Program Files\erl9.3
the problem solved. So, definitely it is a path issue.
In my case, it should be installed erlang using admin role running
If above solutions doesn't work for you then you can try following
Find another compatible version of erlang for your rabbit mq e.g. for rabbit 3.7.x erlang version 20.3.x to 22.0.x all are compatible .
Right click newly downloaded erlang version and from properties select the option to unblock the file .
Run the erlang with admin persssion .
Re run rabbit mq exe

Resources