PS1 (PowerShellScript) always failing
My PS1 Script always fails at line 2:
$root = (split-path -parent $MyInvocation.MyCommand.Definition) + '\..'
$version = [System.Reflection.Assembly]::LoadFile("$root\src\Migrator\bin\Migrator\Debug\Migrator.dll").GetName().Version
but I got this from here: http://www.codeproject.com/Tips/806257/Automating-NuGet-Package-Creation-using-AppVeyor where it works.
And it also works on my local machine!
Here the error:
Exception calling "LoadFile" with "1" argument(s): "The system cannot find the file specified. (Exception from HRESULT: 0x80070002)"
At C:\projects\migrator-net\nuget\pack.ps1:2 char:1
+ $version = [System.Reflection.Assembly]::LoadFile("$root\src\Migrator\bin\Migrat ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : FileNotFoundException
Setting .nuspec version tag to ..
Attempting to build package from 'Package.compiled.nuspec'.
NuGet.exe : '..' is not a valid version string.
At C:\projects\migrator-net\nuget\pack.ps1:12 char:1
+ & $root\NuGet\NuGet.exe pack $root\nuget\Package.compiled.nuspec
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ('..' is not a valid version string.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Parameter name: version
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
| ? | Show this help |
|---|---|
| ESC | Blurs the current field |
Comment Form
| r | Focus the comment reply box |
|---|---|
| ^ + ↩ | Submit the comment |
You can use Command ⌘ instead of Control ^ on Mac

1 Posted by Jochen Kühner on 04 Aug, 2015 02:22 PM
This was my error! I thought the $root was ignored,but my FileName was wrong!
Sorry
Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 01:58 AM.