RestCode / WebApiProxy

MIT License
199 stars 91 forks source link

Changeset added bin\debug for loading WebApiProxy.Tasks.dll #85

Open onionhammer opened 8 years ago

onionhammer commented 8 years ago

On WebApiProxy-Generate-CSharp command:

Changeset

Add-Type -Path (Join-Path $projectPath "bin\Debug\WebApiProxy.Tasks.dll")

This can lead to errors as WebApiProxy.Tasks.dll isn't built/added to the bin/debug folder

\bin\Debug\WebApiProxy.Tasks.dll' because it does not exist.
onionhammer commented 8 years ago

Now I'm getting this

PM> WebApiProxy-Generate-CSharp
Cannot bind argument to parameter 'Path' because it is null.
    + CategoryInfo          : InvalidData: (:) [Add-Type], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.AddTypeCommand
    + PSComputerName        : localhost

Unable to find type [WebApiProxy.Tasks.Models.Configuration]. Make sure that the assembly that contains this type is loaded.
    + CategoryInfo          : InvalidOperation: (WebApiProxy.Tasks.Models.Configuration:TypeName) [], RuntimeException
    + FullyQualifiedErrorId : TypeNotFound
    + PSComputerName        : localhost

Cannot find type [WebApiProxy.Tasks.Infrastructure.CSharpGenerator]: verify that the assembly containing this type is loaded.
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
    + PSComputerName        : localhost

Generating proxy code...
You cannot call a method on a null-valued expression.
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
    + PSComputerName        : localhost
faniereynders commented 8 years ago

What version of Powershell & VS are you using?

onionhammer commented 8 years ago

Visual Studio 2015 on windows 8.1?

faniereynders commented 8 years ago

Weird I cannot seem to reproduce this. Just tested it on your config as well and it works. I did however make changes to the package file to include the libs on the correct build configuration inside the project

DigitalDel commented 8 years ago

@onionhammer did you ever resolve this? I've now started getting this error as well despite it previously working fine?

DigitalDel commented 8 years ago

Problem identified.

This will occur if you have multiple projects in your VS Solution. I have 3 projects in my Solution:

The MVC app is the one on which i am trying to generate the proxy code however when i edited the WebApiProxyCSharp.psm1 file to print out the project path it is returning the path for my API project not the path of the MVC project the package is installed on and which has the references to WebApiProxy.Core and WebApiProxy.Tasks.

Anyone any advice on how to fix? I did try adding references to WebApiProxy.Core and WebApiProxy.Tasks to the other projects in my solution and but WebApiProxyCSharp.psm1 uses the project path to identify the config and output paths which are obviously in the API project not the MVC project where the package is installed.

The only solution i can think of at the moment is to install the package on the API project, generate the proxy code there and manually copy the generated file to the correct project but it doesn't make it particularly friendly to work with.