peachpie
peachpie copied to clipboard
Change Sdk version to 1.1.5 make error when running
Steps:
Install project
dotnet new web -lang PHP
Change netcoreapp version and Peachpie.AspNetCore.Web in Server.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Peachpie.AspNetCore.Web" Version="1.1.5" />
<ProjectReference Include="..\Website\Website.msbuildproj" />
</ItemGroup>
</Project>
Change Website.msbuildproj Sdk version
<Project Sdk="Peachpie.NET.Sdk/1.1.5">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>dotnet</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile
Include="**/*.php"
Exclude="obj/**;bin/**;" />
<Content
Include="**"
Exclude="**/*.php;obj/**;bin/**;*.msbuildproj;.vscode/**;.vs/**;">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</Content>
<None Remove="**" />
</ItemGroup>
</Project>
Then run
dotnet run --project Server
Show the errors below
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : Peachpie.Runtime not found [E:\www\test\dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.PhpCompilation.ReferenceManager.CreateSourceAssemblyForCompilati
on(PhpCompilation compilation) in D:\a\1\s\src\Peachpie.CodeAnalysis\Symbols\ReferenceManager.cs:
line 264 [E:\www\test\dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.PhpCompilation.GetBoundReferenceManager() in D:\a\1\s\src\Peachp
ie.CodeAnalysis\Compilation\PhpCompilation.cs:line 884 [E:\www\test\dotnet\Website\Website.msbuil
dproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.PhpCompilation.get_CorLibrary() in D:\a\1\s\src\Peachpie.CodeAna
lysis\Compilation\PhpCompilation.cs:line 61 [E:\www\test\dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.PhpCompilation.CommonGetSpecialType(SpecialType specialType) in
D:\a\1\s\src\Peachpie.CodeAnalysis\Compilation\PhpCompilation.Types.cs:line 533 [E:\www\test\dotn
et\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.PhpCompilation.GetSpecialType(SpecialType specialType) in D:\a\1
\s\src\Peachpie.CodeAnalysis\Compilation\PhpCompilation.Types.cs:line 517 [E:\www\test\dotnet\Web
site\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.Symbols.SourceSymbolCollection.PopulateDefinedConstants(Synthesi
zedTypeSymbol container, ImmutableDictionary`2 defines) in D:\a\1\s\src\Peachpie.CodeAnalysis\Sym
bols\Source\SourceSymbolCollection.cs:line 200 [E:\www\test\dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.Symbols.SourceSymbolCollection..ctor(PhpCompilation compilation)
in D:\a\1\s\src\Peachpie.CodeAnalysis\Symbols\Source\SourceSymbolCollection.cs:line 149 [E:\www\
test\dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.PhpCompilation..ctor(String assemblyName, PhpCompilationOptions
options, ImmutableArray`1 references, Boolean isSubmission, ReferenceManager referenceManager, Bo
olean reuseReferenceManager, AsyncQueue`1 eventQueue) in D:\a\1\s\src\Peachpie.CodeAnalysis\Compi
lation\PhpCompilation.cs:line 166 [E:\www\test\dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.PhpCompilation.Create(String assemblyName, IEnumerable`1 syntaxT
rees, IEnumerable`1 references, IEnumerable`1 resources, PhpCompilationOptions options) in D:\a\1
\s\src\Peachpie.CodeAnalysis\Compilation\PhpCompilation.cs:line 337 [E:\www\test\dotnet\Website\W
ebsite.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.CommandLine.PhpCompiler.CreateCompilation(TextWriter consoleOutp
ut, TouchedFileLogger touchedFilesLogger, ErrorLogger errorLogger, ImmutableArray`1 analyzerConfi
gOptions) in D:\a\1\s\src\Peachpie.CodeAnalysis\CommandLine\PhpCompiler.cs:line 171 [E:\www\test\
dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Microsoft.CodeAnalysis.CommonCompiler.RunCore(TextWriter consoleOutput, ErrorLogge
r errorLogger, CancellationToken cancellationToken) in C:\Users\jmise\Projects\Peachpie.Microsoft
.CodeAnalysis\src\Compilers\Core\Portable\CommandLine\CommonCompiler.cs:line 789 [E:\www\test\dot
net\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Microsoft.CodeAnalysis.CommonCompiler.Run(TextWriter consoleOutput, CancellationTo
ken cancellationToken) in C:\Users\jmise\Projects\Peachpie.Microsoft.CodeAnalysis\src\Compilers\C
ore\Portable\CommandLine\CommonCompiler.cs:line 699 [E:\www\test\dotnet\Website\Website.msbuildpr
oj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Pchp.CodeAnalysis.CommandLine.PhpCompilerDriver.Run(CommandLineParser parser, Stri
ng responseFile, String[] args, String clientDirectory, String baseDirectory, String sdkDirectory
, String additionalReferenceDirectories, IAnalyzerAssemblyLoader analyzerLoader, TextWriter outpu
t, CancellationToken cancellationToken) in D:\a\1\s\src\Peachpie.CodeAnalysis\CommandLine\PhpComp
ilerDriver.cs:line 21 [E:\www\test\dotnet\Website\Website.msbuildproj]
C:\Users\Simon\.nuget\packages\peachpie.net.sdk\1.1.5\build\Peachpie.NET.Core.Sdk.targets(245,5):
error : at Peachpie.NET.Sdk.Tools.BuildTask.Execute() in D:\a\1\s\src\Peachpie.NET.Sdk\BuildT
ask.cs:line 283 [E:\www\test\dotnet\Website\Website.msbuildproj]
I can make sure 1.1.5 was auto installed in my PC.
我也遇到了同样的问题,请问解决了吗
我好像解决了这个问题,只需要将netstandard2.1 改成 netcoreapp7.0,就可以了
netcoreapp7.0 -> net7.0
Change to net7.0 works.
Thank you for the confirmation.