Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in install.ps1 #1

Closed
jeremysimmons opened this issue Aug 7, 2014 · 19 comments
Closed

Error in install.ps1 #1

jeremysimmons opened this issue Aug 7, 2014 · 19 comments

Comments

@jeremysimmons
Copy link
Contributor

Visual Studio 2012 Ultimate Update 4
Package Manager 2.8.50313.31

when installing, I get this error:
Exception calling "Item" with "1" argument(s): "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
At C:\dev\Projects\AttachmentUnitTests\packages\WebDriver.IEDriverServer.win32.2.42.0\tools\install.ps1:9 char:1

Error is with this line
$file = Join-Path (Join-Path $toolsPath '..\content') 'IEDriverServer.exe' | Get-ChildItem

The expression
Join-Path (Join-Path $toolsPath '..\content') 'IEDriverServer.exe'
gives the value
C:\dev\Projects\AttachmentUnitTests\packages\WebDriver.IEDriverServer.win32.2.42.0\tools..\content\IEDriverServer.exe

The expression
Join-Path (Join-Path $toolsPath '..\content') 'IEDriverServer.exe' | Get-ChildItem
gives the value
C:\dev\Projects\AttachmentUnitTests\packages\WebDriver.IEDriverServer.win32.2.42.0\content

@jeremysimmons
Copy link
Contributor Author

issue is not actually with the line of code I thought it was.
issue is with code
$project.ProjectItems.Item($file.Name)
Exception calling "Item" with "1" argument(s): "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"

@SeriousM
Copy link
Owner

SeriousM commented Aug 7, 2014

oookay, do you have a clue how to fix it?

I use the same install script for the chrome-driver which works on my machine.
Which nuget version you're using?

@jeremysimmons
Copy link
Contributor Author

Thanks for the reply.
No clue...
Same script works on different machines in my team.
There's got to be some kind of configuration issue going on with my machine.

On Thu, Aug 7, 2014 at 3:10 PM, Bernhard Millauer notifications@github.com
wrote:

oookay, do you have a clue how to fix it?

I use the same install script for the chrome-driver
https://github.com/SeriousM/WebDriver.ChromeDriver.win32-nuget/blob/master/tools/install.ps1
which works on my machine.
Which nuget version you're using?


Reply to this email directly or view it on GitHub
#1 (comment)
.

@SeriousM
Copy link
Owner

SeriousM commented Aug 8, 2014

ok, can I close the issue?

@jeremysimmons
Copy link
Contributor Author

Yes you may. I've asked on StackOverflow here:
http://stackoverflow.com/questions/25193903/why-does-this-nuget-install-script-fail

On Fri, Aug 8, 2014 at 2:11 AM, Bernhard Millauer notifications@github.com
wrote:

ok, can I close the issue?


Reply to this email directly or view it on GitHub
#1 (comment)
.

@jeremysimmons
Copy link
Contributor Author

Figured out the issue -
Moving the CSPROJ to a level that would not automatically include the
Packages folder fixed the issue.

I was able to get the install working fine using this modified install.ps1
$pi = $project.ProjectItems.AddFromFile($file.FullName);
#$pi = $project.ProjectItems.Item($file.Name);
$pi.Properties.Item("BuildAction").Value = [int]2;

and this modified uninstall.ps1
param($installPath, $toolsPath, $package, $project)

#$file = Join-Path (Join-Path $toolsPath '..\content') 'IEDriverServer.exe'
| Get-ChildItem
#$project.ProjectItems.Item($file.Name).Delete()

$ErrorActionPreference = "SilentlyContinue"
$pi = $null
$pi = $project.ProjectItems.Item($file.Name)
if $pi -eq $null then $pi =
$project.ProjectItems.Item("packages").ProjectItems.Item($package).ProjectItems.Item("content").ProjectItems.Item("IEDriverServer.exe")
if $pi -ne $null then $pi.Delete()

On Fri, Aug 8, 2014 at 10:04 AM, Jeremy Simmons jsimmons@jeremysimmons.net
wrote:

Yes you may. I've asked on StackOverflow here:
http://stackoverflow.com/questions/25193903/why-does-this-nuget-install-script-fail

On Fri, Aug 8, 2014 at 2:11 AM, Bernhard Millauer <
notifications@github.com> wrote:

ok, can I close the issue?


Reply to this email directly or view it on GitHub
#1 (comment)
.

@jeremysimmons
Copy link
Contributor Author

Overall - I believe that this InstallScript is not robust enough to handle the case when the Packages folder is in the same directory as the CSPROJ without causing errors.
You could easily replicate this by having the SLN and CSPROJ in the same directory when installing the package.

@SeriousM
Copy link
Owner

SeriousM commented Aug 8, 2014

wow, thanks for the help!
I'm not a huge fan of powershell and tbh I hate scripting it because I have no experience with it.
would you be able to create a PR to fix this edge-case issue please?

@jsakamoto
Copy link

I'm a developer of Selenium.WebDriver.IEDriver NuGet package.
https://github.com/jsakamoto/nupkg-selenium-webdriver-iedriver

I run into same issue on my avobe project.

I would try to resolve this issue, but I'm feeling it is too difficult to resolve this issue because it is specification of Visual Studio...

@SeriousM
Copy link
Owner

would try to resolve this issue, but I'm feeling it is too difficult to resolve this issue because it is specification of Visual Studio...

The issue is too edge-case to me to fix it immediately.
What we would need to have is like a switch if the solution and the project is in the same folder, and if, deal with it differently.
As I said I'm not a PS hero and really don't know how to write this kind of checks.
If someone feels able to fix the problem please help, otherwise I will close this issue in a week.
Thanks

@jeremysimmons
Copy link
Contributor Author

@jsakamoto thank you for confirming the issue. I was starting to feel crazy.

Sent from my iPhone

On Aug 10, 2014, at 9:49 PM, jsakamoto notifications@github.com wrote:

I'm a developer of Selenium.WebDriver.IEDriver NuGet package.
https://github.com/jsakamoto/nupkg-selenium-webdriver-iedriver

I run into same issue on my avobe project.

I would try to resolve this issue, but I'm feeling it is too difficult to resolve this issue because it is specification of Visual Studio...


Reply to this email directly or view it on GitHub.

@jeremysimmons
Copy link
Contributor Author

@SeriousM I am on vacation this week and will work on a fix for the edge case. Keep your eye out for a patch.

Sent from my iPhone

On Aug 11, 2014, at 1:47 AM, Bernhard Millauer notifications@github.com wrote:

would try to resolve this issue, but I'm feeling it is too difficult to resolve this issue because it is specification of Visual Studio...

The issue is too edge-case to me to fix it immediately.
What we would need to have is like a switch if the solution and the project is in the same folder, and if, deal with it differently.
As I said I'm not a PS hero and really don't know how to write this kind of checks.
If someone feels able to fix the problem please help, otherwise I will close this issue in a week.
Thanks


Reply to this email directly or view it on GitHub.

@SeriousM
Copy link
Owner

awesome! thank you :)

On 8/11/14, Jeremy Simmons notifications@github.com wrote:

@SeriousM I am on vacation this week and will work on a fix for the edge
case. Keep your eye out for a patch.

Sent from my iPhone

On Aug 11, 2014, at 1:47 AM, Bernhard Millauer notifications@github.com
wrote:

would try to resolve this issue, but I'm feeling it is too difficult to
resolve this issue because it is specification of Visual Studio...

The issue is too edge-case to me to fix it immediately.
What we would need to have is like a switch if the solution and the
project is in the same folder, and if, deal with it differently.
As I said I'm not a PS hero and really don't know how to write this kind
of checks.
If someone feels able to fix the problem please help, otherwise I will
close this issue in a week.
Thanks


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub:
#1 (comment)

@jsakamoto
Copy link

@jeremysimmons I tried to handle the case when the packages folder is in the same directory as the CSPROJ on my project (not for your project, so I can not send to you pull request...)

The commit is here:
jsakamoto/nupkg-selenium-webdriver-iedriver@4e62c71

and publish Beta release:
https://www.nuget.org/packages/Selenium.WebDriver.IEDriver/2.42.0.1-beta

My strategy is using Microsoft.Build class library, and treat CSPROJ as a MSBuild script XML instead of DTEnv object model when detected the same directory case.

In that case, WebDriver.exe linked project item does not appear in the Solution Explorer of Visual Studio (I think, it may be by design of Visual Studio), but copying the driver .exe file into bin folder is work well.

Is it helpful?
Thanks.

@jeremysimmons
Copy link
Contributor Author

It looks very helpful. Thanks @jsakamoto!

Have you have tried to implement automated functional tests for nuget?

Sent from my iPhone

On Aug 13, 2014, at 11:07 AM, jsakamoto notifications@github.com wrote:

@jeremysimmons I tried to handle the case when the packages folder is in the same directory as the CSPROJ on my project (not for your project, so I can not send to you pull request...)

The commit is here:
jsakamoto/nupkg-selenium-webdriver-iedriver@4e62c71

and publish Beta release:
https://www.nuget.org/packages/Selenium.WebDriver.IEDriver/2.42.0.1-beta

My strategy is using Microsoft.Build class library, and treat CSPROJ as a MSBuild script XML instead of DTEnv object model when detected the same directory case.

In that case, WebDriver.exe linked project item does not appear in the Solution Explorer of Visual Studio (I think, it may be by design of Visual Studio), but copying the driver .exe file into bin folder is work well.

Is it helpful?
Thanks.


Reply to this email directly or view it on GitHub.

@jsakamoto
Copy link

@jeremysimmons Thank you for your reply.

Have you have tried to implement automated functional tests for nuget?

No, not yet.

I have interested in automated testing for programing codes and web applications. (so that I'm creating the package of Selenium for all people who challenging automated browser test :) )

But, I'm hampered by high barriers to mocking about NuGet installation/uninstallation process.

Have you have tried it? Have you any idea?

@jeremysimmons
Copy link
Contributor Author

@jsakamoto I am currently trying to figure out how to execute the nuget EndToEnd tests

@jeremysimmons
Copy link
Contributor Author

@SeriousM I implemented the modification to the install.ps1 and uninstall.ps1 using the code from @jsakamoto's nuget package. Pull Request

@SeriousM
Copy link
Owner

ok, we'll discuss there. Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants