Comments (15)
after I got that error I did. then it built.
from polaris.
No need to build anymore :)
from polaris.
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.
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.
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.
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.
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.
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.
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.
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.
@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.
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.
@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.
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.
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)
- Documentation: $Request / $Response HOT 1
- Documentation: Update examples in documentation. HOT 2
- Question: Authentication HOT 10
- [Question] how does Polaris Scales? HOT 3
- PSReadline again HOT 1
- [Question] how do I force the code to end the request before the end of the routine is reached? HOT 4
- Reroute wiki pages to detailed pages located in /docs HOT 2
- stop-polaris not stopping the web server over 8080 or any port it's started with. HOT 6
- REST API Pagination? HOT 2
- Exception using Start-Polaris when PowerShell strict mode is enabled. HOT 1
- Kerberos configuration for -Auth Negociate HOT 4
- Unable to run as a non-admin HOT 6
- Standardized logging HOT 2
- Polaris exits immediately when run in a container HOT 5
- Start-Polaris missing hostname parameter HOT 2
- Polaris leaves behind a couple of event subscribers
- Add support for web socket endpoints
- Minimum requirements for Polaris? HOT 1
- Possible Memory leak HOT 1
- Polaris support latest powershell version, like powershell 7.1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from polaris.