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

Flancy Broken: Instantly didn't work following the directions on a new install of Windows and VSCode #45

Open
ghost opened this issue Dec 25, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 25, 2021

I was told this following code would be EASY!

import-module flancy
$url = "http://localhost:8001"

new-flancy -url $url -webschema @(
Get '/' { "Welcome to Flancy!" }
Get '/processes' {
$processes = Get-Process
$processes |select name, id |convertto-json
}
)

Sure it looks easy but the dependencies the code requires are not available by default in Windows and I just spent 4 hours unsuccessfully trying to get them.

new-flancy -url $url -webschema @(

Get '/' { "Welcome to Flancy!" }
Get '/processes' {
    $processes = Get-Process
    $processes |select name, id |convertto-json
}

)
Add-Type: (2,14): error CS0234: The type or namespace name 'Management' does not exist in the namespace 'System' (are you missing an assembly reference?) using
System.Management.Automation; ^

Add-Type: (9,27): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. public class Module : NancyModule ^

Add-Type: (56,39): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. public class CustomBootstrapper : DefaultNancyBootstrapper ^

Add-Type: (58,28): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. protected override IRootPathProvider RootPathProvider ^

Add-Type: (11,16): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. public PowerShell shell = PowerShell.Create(); ^

Add-Type: (11,16): error CS0246: The type or namespace name 'PowerShell' could not be found (are you missing a using directive or an assembly reference?) public PowerShell
shell = PowerShell.Create(); ^

Add-Type: (48,48): error CS0012: The type 'Type' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. } public class CustomRootPathProvider : IRootPathProvider ^

Add-Type: (62,54): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. protected override void ConfigureConventions(NancyConventions conventions)
^

Add-Type: (60,29): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. get {return new CustomRootPathProvider();} ^

Add-Type: (11,35): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. public PowerShell shell = PowerShell.Create(); ^

Add-Type: (11,35): error CS0103: The name 'PowerShell' does not exist in the current context public PowerShell shell = PowerShell.Create();

^

Add-Type: (64,18): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. base.ConfigureConventions(conventions); ^

Add-Type: (90,43): error CS0234: The type or namespace name 'WindowsIdentity' does not exist in the namespace 'System.Security.Principal' (are you missing an assembly reference?)
config.UrlReservations.User = System.Security.Principal.WindowsIdentity.GetCurrent().Name; ^

Add-Type: (93,29): error CS0012: The type 'Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'. this.host = new NancyHost(config, uri); ^

Add-Type: (104,23): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. this.host.Start(); ^

Add-Type: (107,23): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. this.host.Stop(); ^

Add-Type: (14,13): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. StaticConfiguration.DisableErrorTraces = false; ^

Add-Type: (16,13): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. Get["/"] = _ => {try { ^

Add-Type: (30,13): error CS0012: The type 'Func<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. Get["/processes"] = _ => {try { ^

Add-Type: (30,13): error CS0012: The type 'Func<,,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089'. Get["/processes"] = _ => {try { ^
$psversiontable
rameter 'Exception' because it is null.

                                                  alued expression.
@robinmalik
Copy link

Before I spend any amount of time trying to get a project to work, I tend to check the date of the last commit to try and guess whether it's still supported; this codebase was last updated 6 years ago. Whilst it really was very simple then (and for some years after) sadly it seems something has changed! I can't speak for the maintainer as to whether it'll be updated to address these issues but I can recommend Pode which is under active development (and also simple): https://github.com/Badgerati/Pode/

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

1 participant