I just started to install NativeScript on Windows 10 with this command:
#powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
that I got from installation guide here https://docs.nativescript.org/angular/start/quick-setup
But I get this error message:
Exception calling "DownloadString" with "1" argument(s): "Unable to connect to the remote server"
At line:1 char:1
+ iex ((new-object net.webclient).DownloadString('https://www.nativescr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
C:\Windows\system32>#powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://www.nativescript.org/setup/win'))"
Exception calling "DownloadString" with "1" argument(s): "Unable to connect to the remote server"
At line:1 char:1
+ iex ((new-object net.webclient).DownloadString('https://www.nativescr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
What is the problem and how can I fix?
The following steps worked for me:
Download the file from the URL (https://www.nativescript.org/setup/win).
Run cmd as administrator and cd to the directory where you downloaded the file.
In cmd execute the following: powershell -noexit "& ""./native-script.ps1"""
Related
I was trying set NODE_ENV development enviroment and it's not working, here the response in the terminal
At line:1 char:1
+ SET NODE_ENV=development nodemon server.js
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Set-Va
riable], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,
Microsoft.PowerShell.Commands.SetVariableCommand
try each one seperately:
SET NODE_ENV=development
nodemon server.js
I tried to Install-Package Microsoft.AspNet.Web.Optimization, but it throws this error:
Install-Package : Object reference not set to an instance of an object.
At line:1 char:1
Install-Package Microsoft.AspNet.Web.Optimization -Pre
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [Install-Package], Exception
FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Edit:
I managed to get it to accept 1 parameter. Apparently it hates accepting 2. Now I've got another exception: remote server returning 401 unauthorized. I guess the solution for this is to not use more than 1 parameter, but that's not really a solution. Sounds like a bug to me.
Original question:
I'm at my wit's end on this one.
I have a powershell script that I'd like to execute during a Release that uploads an archived copy of the build to a document library in SharePoint. The build server that hosts TFS 2017 is running Powershell 4. When I RDP in and run the below script in ISE on the same server (precisely where TFS appears to be executing things in the tasks), it works, provided that I add the environment variables where they are commented in the script below.
When I run the same exact script (I'm running it from the drop folder) via TFS, it produces the error:
2017-10-17T13:48:52.5561597Z D:\BuildAgentWorkFolder\f00869677\Git\drop\publish_to_sharepoint.ps1 D:\Integration_20171017.2.zip Integration_20171017.2
2017-10-17T13:48:53.0241597Z Connecting to http://sharepoint_server/sites/TFS_DefaultCollection/NET as srv_promote...
2017-10-17T13:48:53.2737597Z ##[error]D:\BuildAgentWorkFolder\f00869677\Git\drop\publish_to_sharepoin
2017-10-17T13:48:53.2737597Z ##[error]t.ps1 : Cannot bind argument to parameter 'String' because it is null.
which is crazy, because you can clearly see the non-null arguments in the line executing the script.
I have tried specifying the type in the param section, like [string]$filePathToUpload. I have tried specifying the parameters in the command line arguments list, like .\publish_to_sharepoint.ps1 -filePathToUpload "..." -fileName "...", both with and without quotation marks.
One thing to note is when I try to run the task with an in-line powershell script-- because of the character limit, I can only paste up to the first "Write-Host" line-- it passes the parameter step without error and the release passes.
Is this a bug with TFS Powershell task? I can't wrap my head around where this error is coming from.
Thanks in advance. Below are the relevant details.
Powershell script:
param(
$filePathToUpload,
$fileName
)
#$Env:SharePointDomain = "..."
#$Env:SharePointBaseUrl = "http://sharepoint_server"
#$Env:SharePointSite = "/sites/TFS_DefaultCollection/NET/"
#$Env:SharePointUsername = "username"
#$Env:SharePointPassword = "password"
#$Env:SharePointLibrary = "library_name"
Add-Type -AssemblyName "Microsoft.SharePoint.Client, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"
Add-Type -AssemblyName "Microsoft.SharePoint.Client.Runtime, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL"
Write-Host 'Connecting to'$Env:SharePointBaseUrl$Env:SharePointSite' as '$Env:SharePointUsername'...'
try{
$sharepointFullUrl = $Env:SharePointBaseUrl + $Env:SharePointSite
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext $sharepointFullUrl
$clientContext.Credentials = New-Object System.Net.NetworkCredential $Env:SharePointUsername, (ConvertTo-SecureString $Env:SharePointPassword -AsPlainText -Force)
$web = $clientContext.Web
$clientContext.Load($web)
$clientContext.ExecuteQuery();
$relDestFilePath = $Env:SharePointSite + $Env:SharePointLibrary + "/" + $fileName
$fStream = New-Object IO.FileStream $filePathToUpload ,'Open','Read','Read'
[Microsoft.SharePoint.Client.File]::SaveBinaryDirect($clientContext, $relDestFilePath, $fStream, $true)
Write-Host 'Successfully uploaded'$fileName' to SharePoint document library '$Env:SharePointLibrary'.'
}
catch {
Write-Error $_
}
Release Task Detail:
Release Environment Variables:
Powershell Task Log
2017-10-17T13:48:52.5405597Z . 'D:\BuildAgentWorkFolder\f00869677\Git\drop\publish_to_sharepoint.ps1' D:\Integration_20171017.2.zip Integration_20171017.2
2017-10-17T13:48:52.5561597Z C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command "$env:PSModulePath= $env:PSModulePath + ';' + $([system.io.path]::combine($env:AGENT_HOMEDIRECTORY, 'agent\worker\modules')); try { [System.Security.Cryptography.ProtectedData] | Out-Null } catch { Write-Verbose 'Adding assemly: System.Security' ; Add-Type -AssemblyName 'System.Security' ; [System.Security.Cryptography.ProtectedData] | Out-Null } ; Invoke-Expression -Command ([System.Text.Encoding]::UTF8.GetString([System.Security.Cryptography.ProtectedData]::Unprotect([System.Convert]::FromBase64String('AQAAANCMnd8BFdERjHoAwE/Cl+sAmMDwyguygfTgNLUK3BteusFUlUwAAAAACAAAAAAADZgAAwAAAABAAAACMb/7FzkttmPEf8rMCA10mAAAAAASAAACgAAAAEAAAAN7Pqk+I01BNW4lONiyiuhArrpBqYAAiGrvCfLy/fPm3YiAEuhiuhKwcUEIZFza2IcrqjhKCe4Qn8qRcPMfDEiw82ZUKdNYCrzUjayfThC97Vm3/lNgP15sgTr0NpJwsfvs7fz6zG3zwqwNeu4ivYzcYI/bYd+y608v+jh3d+8vzeQgyIGhto+9WcJlIaCnYv5qymVD7nTME8pnYz+DfNkP02s50jkCySimKgVHGIUAAAAkXCoQxu5+9njKHMCkhB2FSpdivg='), [System.Convert]::FromBase64String('McDlBBSayxJHIwJ35ERNNQ=='), [System.Security.Cryptography.DataProtectionScope]::CurrentUser))) ; if (!(Test-Path -LiteralPath variable:\LastExitCode)) { Write-Verbose 'Last exit code is not set.' } else { Write-Verbose ('$LastExitCode: {0}' -f $LastExitCode) ; exit $LastExitCode }"
2017-10-17T13:48:52.5561597Z Executing the following powershell script. (workingFolder = D:\BuildAgentWorkFolder\f00869677)
2017-10-17T13:48:52.5561597Z D:\BuildAgentWorkFolder\f00869677\Git\drop\publish_to_sharepoint.ps1 D:\Integration_20171017.2.zip Integration_20171017.2
2017-10-17T13:48:53.0241597Z Connecting to http://sharepoint_server/sites/TFS_DefaultCollection/NET as srv_promote...
2017-10-17T13:48:53.2737597Z ##[error]D:\BuildAgentWorkFolder\f00869677\Git\drop\publish_to_sharepoin
2017-10-17T13:48:53.2737597Z ##[error]t.ps1 : Cannot bind argument to parameter 'String' because it is null.
2017-10-17T13:48:53.2737597Z ##[error]At line:1 char:1
2017-10-17T13:48:53.2737597Z ##[error]+ .
2017-10-17T13:48:53.2737597Z ##[error]'D:\BuildAgentWorkFolder\f00869677\Git\drop\publish_to_sharepo
2017-10-17T13:48:53.2737597Z ##[error]...
2017-10-17T13:48:53.2737597Z ##[error]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-10-17T13:48:53.2737597Z ##[error]~~~
2017-10-17T13:48:53.2737597Z ##[error] + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorExcep
2017-10-17T13:48:53.2737597Z ##[error] tion
2017-10-17T13:48:53.2737597Z ##[error] + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorExceptio
2017-10-17T13:48:53.2737597Z ##[error] n,publish_to_sharepoint.ps1
2017-10-17T13:48:53.2737597Z ##[error]
2017-10-17T13:48:53.2737597Z ##[error]Process completed with exit code 0 and had 1 error(s) written to the error stream.
This is the issue: $Env:SharePointPassword. Secrets aren't stored as environment variables. Modify your script and pass in the password as a parameter.
I just migrated my Entity Framework from 5 to 6. Then when i tried to run Enable-Migrations command suddenly i got these errors:
Exception calling "LoadFrom" with "1" argument(s): "Could not load file or
assembly 'file:///D:\BitBucketGit\packages\EntityFramework.5.0.0\tools
\EntityFramework.PowerShell.Utility.dll' or one of its dependencies.
Operation is not supported.
(Exception from HRESULT: 0x80131515)" At D:\BitBucketGit\packages
\EntityFramework.6.1.3\tools\EntityFramework.psm1:780 char:5 +
$utilityAssembly = [System.Reflection.Assembly]::LoadFrom((Join-Path
$ToolsP ... +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileLoadException
You cannot call a method on a null-valued expression.
At D:\BitBucketGit\packages\EntityFramework.6.1.3\tool
\EntityFramework.psm1:781 char:5
+ $dispatcher = $utilityAssembly.CreateInstance(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Exception calling "CreateInstanceFrom" with "8" argument(s): "Could not
load file or assembly
'file:///D:\BitBucketGit\packages\EntityFramework.5.0.0\tools
\EntityFramework.PowerShell.dll' or one of its dependencies. Operation is
not supported. (Exception from HRESULT: 0x80131515)"
At D:\BitBucketGit\packages\EntityFramework.6.1.3\tools
\EntityFramework.psm1:809 char:5
+ $domain.CreateInstanceFrom(
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileLoadException
After googling,some suggested to imply a full trust on the package folder which i did. But the error remains.
Is there any other way i can make it fixed.
cheers,
John
Thank for any help. Actually i just found the answer by changing the devenv.exe.config files.
Since I pulled the project from a remote server, I solved this issue by removing all contents of packages folder except repositories.config file and restored all NuGet packages.
I am building windows phone 8 and when I try to install AutoMapper Package, I got these errors:
PM> Install-Package AutoMapper
Installing 'AutoMapper 3.1.0'.
Successfully installed 'AutoMapper 3.1.0'.
Adding 'AutoMapper 3.1.0' to AutoMapper.
Successfully added 'AutoMapper 3.1.0' to AutoMapper.
Method invocation failed because [Microsoft.Build.Construction.ProjectMetadataElement] doesn't contain a method named 'Where'.
At C:\users\documents\visual studio 2012\Projects\AutoMapper\packages\AutoMapper.3.1.0\tools\wp8\Install.ps1:14
char:3
+ $refPath = $platformSpecificRef.Metadata.Where({ $_.Name -eq "HintPath" }).Val ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
Exception calling "AddItem" with "2" argument(s): "Parameter "include" cannot have zero length."
At C:\users\miniesoft limited\documents\visual studio 2012\Projects\AutoMapper\packages\AutoMapper.3.1.0\tools\wp8\Install.ps1:16
char:3
+ $item = $msbuild.Xml.AddItem("Content", $refPath)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentException
You cannot call a method on a null-valued expression.
At C:\users\miniesoft limited\documents\visual studio 2012\Projects\AutoMapper\packages\AutoMapper.3.1.0\tools\wp8\Install.ps1:17
char:3
+ $item.AddMetadata("Link", [System.IO.Path]::GetFileName($refPath))
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\users\miniesoft limited\documents\visual studio 2012\Projects\AutoMapper\packages\AutoMapper.3.1.0\tools\wp8\Install.ps1:18
char:3
+ $item.AddMetadata("CopyToOutputDirectory", "PreserveNewest")
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
The app can't run, any ideas?