GithubHelp home page GithubHelp logo

Comments (15)

BladeFireLight avatar BladeFireLight commented on September 1, 2024 1

after I got that error I did. then it built.

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024 1

No need to build anymore :)

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

Thanks for this. Let me get some more data from you:

What version of PowerShell are you running this on?
Does this machine have .NET Framework 4.5.1 on it?

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

I have this checkin the build script that basically says build against net451 if you're on Windows.

task Build {
    if (!$script:IsUnix) {
        exec { & $script:dotnetExe build .\PolarisCore\Polaris.csproj -f net451 }
        Write-Host "" # Newline
    }

    exec { & $script:dotnetExe build .\PolarisCore\Polaris.csproj -f netstandard2.0 }
}

This was probably not the best check. I should give the ability for those on Windows to not build against this target framework.

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

As a mitigation, you can do:

PS\> pushd PolarisCore
PS\> dotnet build .\Polaris.csproj -f netstandard2.0
PS\> popd

This will build against dotnetstandard2.0 only and so Polaris will only work in PowerShell Core 6 beta 9.

from polaris.

BladeFireLight avatar BladeFireLight commented on September 1, 2024

looks to me like 1709 comes preloaded with 4.7.1

PSChildName Version   Release Product
----------- -------   ------- -------
Client      4.7.02556  461308
Full        4.7.02556  461308
Client      4.0.0.0

as for your command I had to fix the path a little

PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master> pushd PolarisCore
PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master\PolarisCore> dotnet build .\PolarisCore\Polaris.csproj -f netstandard2.0
MSBUILD : error MSB1009: Project file does not exist.
Switch: .\PolarisCore\Polaris.csproj
PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master\PolarisCore> dotnet build .\Polaris.csproj -f netstandard2.0
Microsoft (R) Build Engine version 15.4.8.50001 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\dotnet\sdk\2.0.2\Microsoft.Common.CurrentVersion.targets(1988,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [C:\Users\Blade\Downloads\Polaris-master\Polaris-master\PolarisCore\Polaris.csproj]
  Polaris -> C:\Users\Blade\Downloads\Polaris-master\Polaris-master\PolarisCore\bin\Debug\netstandard2.0\Polaris.dll

Build succeeded.

C:\Program Files\dotnet\sdk\2.0.2\Microsoft.Common.CurrentVersion.targets(1988,5): warning MSB3277: Found conflicts between different versions of the same dependent assembly that could not be resolved.  These reference conflicts are listed in the build log when log verbosity is set to detailed. [C:\Users\Blade\Downloads\Polaris-master\Polaris-master\PolarisCore\Polaris.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:17.17
PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master\PolarisCore> popd
PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master>

from polaris.

BladeFireLight avatar BladeFireLight commented on September 1, 2024

I'm still not getting the hello world to work

PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master> Import-Module ./Polaris.psm1
PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master> get-command -Module Polaris

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Get-RouteMiddleware                                0.0        Polaris
Function        Get-WebRoute                                       0.0        Polaris
Function        New-DeleteRoute                                    0.0        Polaris
Function        New-GetRoute                                       0.0        Polaris
Function        New-PostRoute                                      0.0        Polaris
Function        New-PutRoute                                       0.0        Polaris
Function        New-RouteMiddleware                                0.0        Polaris
Function        New-StaticRoute                                    0.0        Polaris
Function        New-WebRoute                                       0.0        Polaris
Function        Remove-RouteMiddleware                             0.0        Polaris
Function        Remove-WebRoute                                    0.0        Polaris
Function        Start-Polaris                                      0.0        Polaris
Function        Stop-Polaris                                       0.0        Polaris
Function        Use-JsonBodyParserMiddleware                       0.0        Polaris


PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master> New-GetRoute -Path "/helloworld" -ScriptBlock {
>>     param($request,$response);
>>
>>     $response.Send('Hello World!');
>> }
PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master> Start-Polaris

Port ScriptBlockRoutes                                                                    RouteMiddleware
---- -----------------                                                                    ---------------
8080 {[helloworld, System.Collections.Generic.Dictionary`2[System.String,System.String]]} {}


PS C:\Users\Blade\Downloads\Polaris-master\Polaris-master> Invoke-WebRequest -UseBasicParsing -Uri http://localhost:8080/helloworld


StatusCode        : 200
StatusDescription : OK
Content           :
RawContent        : HTTP/1.1 200 OK
                    Date: Sat, 11 Nov 2017 22:14:57 GMT
                    Server: Microsoft-HTTPAPI/2.0
                    Content-Length: 0
                    Content-Type: text/plain


Forms             :
Headers           : {[Date, System.String[]], [Server, System.String[]], [Content-Length, System.String[]], [Content-Type, System.String[]]}
Images            : {}
InputFields       : {}
Links             : {}
ParsedHtml        :
RawContentLength  : 0
RelationLink      : {}

I would expect the content to not be blank

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

Oh yeah sorry - my steps I gave you were wrong. I fixed them for anyone else that stops by. I want to rename this issue to fix the build script to check for net451 in a better way

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

@BladeFireLight :

where did you see to add:

param($request,$response);
to your script blocks? You don't want to do that anymore as $request and $response are being pulled in from the global scope now.

By having that param statement, you're overwriting $request and $response with null.

If you found that in the docs, I need to fix that.

This breaking change happened in this PR: #49

from polaris.

BladeFireLight avatar BladeFireLight commented on September 1, 2024

is the build for .net 4.x working for you?

I can only get the core20 to work

that is enough to do what I need but I was hoping to use invoke-build

also can the module be ported to another computer once compiled?

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

@BladeFireLight Building the .NET Framework 4.5.1 library works for me on Windows 10 - because I have 4.5.1 on my computer.

Running the .NET Framework 4.5.1 library should work on just about every version of PowerShell (v3 - v6) due to the awesome work that the .NET team has done to support back compat.

You can totally build the .NET 4.5.1 library on a machine that has 4.5.1 and move the dll over to another computer that doesn't have .NET 4.5.1 and it should work.

In your case, you could also do this and build Polaris targeting .NET 4.7.1:

edit this line to include the .NET framework of your choice (ex. net471).

Then do:

PS \> cd PolarisCore
PS \> dotnet build -f <your framework..ex. net471>

Then change this path to point to the correct dll.

This is a pain point right now because Polaris doesn't have any releases - so people have to build it themselves. This will be fixed in the near future, I promise.

from polaris.

BladeFireLight avatar BladeFireLight commented on September 1, 2024

I end up with this error trying -f net471

C:\Program Files\dotnet\sdk\2.0.2\Sdks\Microsoft.NET.Sdk\build\Microsoft.PackageDependencyResolution.targets(165,5): error : Assets file 'C:\Users\dmjones\Desktop\Polaris-master\PolarisCore\obj\project.assets.json' doesn't have a target for '.NETFramework,Version=v4.7.1'. Ensure that restore has run and that you have included 'net471' in the TargetFrameworks for your project. [C:\Users\dmjones\Desktop\Polaris-master\PolarisCore\Polaris.csproj]

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

@BladeFireLight - just checking, did you edit the file I mentioned? https://github.com/PowerShell/Polaris/blob/master/PolarisCore/Polaris.csproj#L3

To include net471?

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

I've been thinking about fixing the build script to just build against the latest .NET Framework and build against .NET Standard 2.0.

It's kind of a strange problem because there are so many different .NET Framework versions and you need the exact one in order to build for it.

In the meantime, I might just allow passing of the target framework to the build script - and if you don't specify anything, we make an educated guess.

That said, Polaris will be in the Gallery soon and you won't have to build at all in order to just use it :)

from polaris.

TylerLeonhardt avatar TylerLeonhardt commented on September 1, 2024

I figured out that what you need is the .NET Framework 4.5.1 Developer Pack to build against that framework. Here's the link to that:
https://www.microsoft.com/en-us/download/details.aspx?id=40772

from polaris.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.