Closed KygekDev closed 3 years ago
thank you for the issue. Is it the whole output? There suppose to be something like
The following template packages will be installed:
Peachpie.Templates
at the beginning of the output. Ref https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new-install
Is it the whole output?
Yes, there is no other outputs.
There suppose to be something like
The following template packages will be installed: Peachpie.Templates
at the beginning of the output.
No, there is no in mine.
does this work in your case?
dotnet new --install Peachpie.Templates::*
No it doesn't.
this is really weird, according to https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-new-install I'm not sure if it's possible for dotnet
to ignore an argument (--install).
The output you have corresponds to the command
dotnet new
without arguments
Oh - I see it. You have it right there:
Console Application console [C#],F#,PHP,VB Common/Console
Class library classlib [C#],F#,PHP,VB Common/Library
PHP
is there. So you have the templates installed.
Okay, so I ran dotnet new console --language php
and it worked. But, when I run dotnet restore
or dotnet run
, I get these errors:
error NU1100: Unable to resolve 'Peachpie.App (>= 1.0.6)' for '.NETFramework,Version=v5.0'.
error NU1100: Unable to resolve 'Peachpie.App (>= 1.0.6)' for '.NETFramework,Version=v5.0/win7-x86'.
I think the Peachpie SDK is not installed or configured properly. What can I do to fix it?
Good. What is the content of the created .msbuildproj
file?
Here's it.
<Project Sdk="Peachpie.NET.Sdk/1.0.6">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<StartupObject>program.php</StartupObject>
<Description>Simpliest PHP project for .NET Core, a console application.</Description>
</PropertyGroup>
<ItemGroup>
<Compile Include="**/*.php" />
</ItemGroup>
</Project>
Seems you might not have .NET Sdk 5.0 installed (https://dotnet.microsoft.com/download)
What is your
dotnet --version
?
It prints 5.0.301, as mentioned above.
EDIT: This might happen because I accidentally run this command and it deleted all files inside %userprofile%\.nuget
: https://stackoverflow.com/a/34935038. I've tried reinstalling both .NET SDK 5 and Core SDK 3.1, but it didn't solved the issue.
It prints 5.0.301, as mentioned above.
right sorry
EDIT: This might happen because I accidentally run this command and it deleted all files inside
%userprofile%\.nuget
https://stackoverflow.com/a/34935038
I was just about to ask if you nuget.org in your nuget sources
Is nuget.org in there?
dotnet nuget list source
Is nuget.org in there?
dotnet nuget list source
No.
try the following
dotnet nuget add source https://api.nuget.org/v3/index.json -n "nuget.org source"
try the following
dotnet nuget add source https://api.nuget.org/v3/index.json -n "nuget.org source"
It worked after I ran dotnet restore
. But I got another error when I run dotnet run
:
C:\Program Files\dotnet\sdk\5.0.301\Microsoft.Common.CurrentVersion.targets(1216,5): error MSB3971: The reference assemblies for ".NETFramework,Version=v5.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK. [C:\Files\phpexe\phpexe.msbuildproj]
The build failed. Fix the build errors and run again.
Seems like a bit broken .NET installation to me (like at https://github.com/dotnet/core/issues/6256 but there is no real solution for Windows).
In your case, the SDK comes with Visual Studio probably, I would try running the Visual Studio Installer
and see if it tells there is an update, maybe it fixes the problem.
In your case, the SDK comes with Visual Studio probably
No, I installed the standalone version of .NET SDK. Actually, I installed Visual Studio before, but then I removed Visual Studio completely before installing .NET SDK.
Seems it's still using the removed VS version tho.
I would guess there will be some Sdks in your Windows Settings / Apps & Features ? Namely "Microsoft .NET SDK 5.0.301 (x64) from Visual Studio". Try Uninstalling it from there, eventually you can uninstall other .NET SDK 5.0.xxx if there's more of them.
I would guess there will be some Sdks in your Windows Settings / Apps & Features ? Namely "Microsoft .NET SDK 5.0.301 (x64) from Visual Studio".
I can see there are only 2 installed .NET SDKs as of in the Settings:
does reinstalling .NET SDK help?
I managed to figure out and solve the issue. So, the issue is with the environment variable. I'll explain further soon.
@KygekDev awesome, i'm interested
I will explain it now.
So, I remembered that I set a MSBuildSDKsPath
environment variable while figuring out a solution for the issue. Then I checked the environment variable. It was set C:\Program Files\dotnet\sdk\3.1.410\Sdks
. Then I changed it to C:\Program Files\dotnet\sdk\5.0.301\Sdks
, and it solved the issue.
makes sense, thanks for sharing the experience with us!
I need one more help.
When I ran dotnet-warp -l aggressive --verbose flag
, it failed, with an output:
Running AddLinkerPackage...
Running dotnet add package --source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json ILLink.Tasks -v 0.1.5-preview-1841731
Determining projects to restore...
Writing C:\Users\COMPUTER\AppData\Local\Temp\tmpEF02.tmp
info : Adding PackageReference for package 'ILLink.Tasks' into project 'C:\Files\phpexe\phpexe.csproj'.
info : Restoring packages for C:\Files\phpexe\phpexe.csproj...
error: Unable to load the service index for source https://dotnet.myget.org/F/dotnet-core/api/v3/index.json.
error: The SSL connection could not be established, see inner exception.
error: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch
I get an SSL error when opening https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
in a browser. So, is there a way to remove the package in the build process?
@KygekDev right, "dotnet-warp" uses https://dotnet.myget.org/
NuGet source which has an invalid SSL certificate. Thus the command fails. I don't see any option where you could override this NuGet source, seems it is hard-coded in there.
I'm not well experienced with "dotnet-warp". Since it is a 3rd party tool, I'd recommend posting an issue at https://github.com/Hubert-Rybak/dotnet-warp
Okay, thanks for your fast response!
I'm glad you got it working!
I hope the last issue will get resolved as well.
Looks like the dotnet-warp
repository has been archived and left unmaintained for more than a year and a half.
I'm afraid so. Although for trimming the resulting assembly, there are built-in features in .NET 5.0 itself - https://devblogs.microsoft.com/dotnet/app-trimming-in-net-5/
Issue
When i ran
dotnet new -i Peachpie.Templates::*
, it just showed a list of available default built-in templates in .NET Core SDK:System Information
dotnet
Version: 5.0.301