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: Add-Type : Cannot bind parameter 'Path' to the target. #107

Closed
edouardr opened this issue Aug 26, 2017 · 10 comments
Closed

Error: Add-Type : Cannot bind parameter 'Path' to the target. #107

edouardr opened this issue Aug 26, 2017 · 10 comments
Labels

Comments

@edouardr
Copy link

User story

In PS console, after having created an empty helix solution, I want to add a new project using
yo helix add:ProjectName

Expected behavior

Project being created with the correct template without errors in the PS console.

Actual behavior

Error is thrown right after executing the command.
*.csproj file is created with the App_Config folder, but that's it.

Steps to reproduce the behavior

Create an empty solution:

PS C:\_\test> yo helix

     _-----_
    |       |    ╭──────────────────────────╮
    |--(o)--|    │  Welcome to the kickass  │
   `---------´   │     Helix generator!     │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? What type of solution do you want to create? Empty Helix solution
? Name of your Helix solution test
? Source code folder name src
? Choose target .net framework version? .net 4.6.1
? Enter the local website URL http://test.local
   create src\Project\Project-layer.md
   create src\Feature\Feature-layer.md
   create src\Foundation\Foundation-layer.md
   create test.sln

Add a new project:

PS C:\_\test> yo helix:add Coffee.Website

     _-----_
    |       |    ╭──────────────────────────╮
    |--(o)--|    │    Lets generate that    │
   `---------´   │         project!         │
    ( _´U`_ )    ╰──────────────────────────╯
    /___A___\   /
     |  ~  |
   __'.___.'__
 ´   `  |° ´ Y `

? Name of your project. (Excluding layer prefix, name can not be empty) Coffee.Website
? Would you like to include Unicorn (serialization)? Yes
? Source code folder name src
? Enter optional vendor prefix
? What layer do you want to add the project too? Project layer?
? Enter optional Module Group
? Choose target .net framework version? .net 4.6.1
Powershell - running: C:\Program Files (x86)\Nodist\bin\node_modules\generator-helix\powershell\add-project.ps1 -SolutionFile 'C:\_\test\test.sln' -Name Project.Coffee.Website -Type Project -ProjectPath 'src\Project\Coffee.Website\code' -SolutionFolderName Coffee.Website
   create src\Project\Coffee.Website\code\Project.Coffee.Website.csproj
   create src\Project\Coffee.Website\code\Properties\AssemblyInfo.cs
   create src\Project\Coffee.Website\code\App_Config\Include\Project.Coffee.Website\serialization.config
adding project Project.Coffee.Website

The following error is thrown:

Error: Add-Type : Cannot bind parameter 'Path' to the target. Exception setting "Path": "Cannot find path 'C:\Microsoft.Build.dll' because it

Error: does not exist."

Error: At C:\Program Files (x86)\Nodist\bin\node_modules\generator-helix\powershell\Get-SolutionConfigurations.ps1:10 char:20

Error: +     Add-Type -Path "$msbuildPath\Microsoft.Build.dll"
Error: +                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error:     + CategoryInfo          : WriteError: (:) [Add-Type], ParameterBindingException
Error:     + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.AddTypeCommand

Error:
Error: Unable to find type [Microsoft.Build.Construction.SolutionFile].
Error: At C:\Program Files (x86)\Nodist\bin\node_modules\generator-helix\powershell\Get-SolutionConfigurations.ps1:11 char:5

Error: +     $solution = [Microsoft.Build.Construction.SolutionFile]::Parse($S ...
Error: +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error:     + CategoryInfo          : InvalidOperation: (Microsoft.Build...on.SolutionFile:TypeName) [], RuntimeException
Error:     + FullyQualifiedErrorId : TypeNotFound

Environment

  • PowerShell version

Name             : ConsoleHost
Version          : 5.0.10240.17443
InstanceId       : 271dbffe-62b6-4188-9cfd-bc30e5ca132d
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-AU
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
  • NPM v 4.0.5
  • Node v 6.10.2
  • Windows 10
  • Generator Helix
PS C:\_\test> npm list -g
C:\Program Files (x86)\Nodist\bin
+-- generator-helix@1.3.2
  • Yeoman yo@2.0.0
@TakeitEasyAlan
Copy link
Member

Sorry to hear that, I am out of the office today and will be back after lunch tomorrow when I hope I will get time to look at this, unless @Hafeok you have time today?

@netojoa
Copy link

netojoa commented Oct 17, 2017

Have you guys sorted this out? I am getting the same error.

Cannot bind parameter 'Path' to the target. Exception setting "Path": "Cannot find path 'X:\Microsoft.Build.dll' because it does not exist."

@edouardr
Copy link
Author

edouardr commented Oct 17, 2017

@JANeto87 unfortunately no. Could I ask what's your environment?

Because I tried in another computer with similar config and could not reproduce. I am trying to find the difference between working and non working environment.

@netojoa
Copy link

netojoa commented Oct 18, 2017

@edouardr, I am using:

  • Microsoft Windows 10 Enterprise Version 10.0.15063 Build 15063 x64
  • Intel(R) Core(TM) i5-7300U CPU @ 2.60GHz, 2701 Mhz, 2 Core(s), 4 Logical Processor(s)
  • Windows Directory is X:\WINDOWS (Don't ask me why "X")
  • I have installed Microsoft Visual Studio Enterprise 2017 Version 15.3.5 (VisualStudio.15.Release/15.3.5+26730.16)

Please see the images below:

System Information
system information

Visual Studio
visual studio

Microsoft.Net Framework folder
microsoft net framework folder

Microsoft.Build in Framework folder
microsoft build in framework folder

Microsoft.Build disassembled, SolutionFile class not found
microsoft build disassembled solutionfile class not found

@Hafeok
Copy link
Contributor

Hafeok commented Oct 20, 2017

Hey,

Can you try and run this form a powershell console?
Resolve-Path HKLM:\SOFTWARE\Microsoft\MSBuild\ToolsVersions* | Get-ItemProperty -Name MSBuildToolsPath

This is the way we are resolving the paths to the msbuild directories right now. And i think that if you only have VS 2017 installed it might not support that.

@netojoa
Copy link

netojoa commented Oct 20, 2017

Please, find below:

untitled

@Hafeok
Copy link
Contributor

Hafeok commented Oct 20, 2017

Yeah, okay - so we need to enable a better way to find the msbuild path, that works with the new VS 2017 structure.

If you want it to work right now, you can install the Microsoft Build Tools 2015
https://www.microsoft.com/en-us/download/details.aspx?id=48159

And ill add a new Issue so that we can it fixed.

The issue is that with the new 2017 installer Microsoft changed the entire eco system of the msbuild installation paths. So we used to lookup the latest installs from the registry, which they changed now.

Anyways the installation of the Microsoft Build Tools should fix it for you.

@netojoa
Copy link

netojoa commented Oct 22, 2017

I've installed MSBuild Tools 2015, but it still doesn't work.

addproject

msbuidl

@TakeitEasyAlan
Copy link
Member

Actually the ability to add visual studio specific modules is not being used, so we will review if this feature should be removed

@TakeitEasyAlan
Copy link
Member

Discussion moved to #109

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

No branches or pull requests

4 participants