Just this morning while drinking 2 cups of my favorite Nescafe Decaf and Alaska Krem-Top, I created my first Peachpie project.
I'm using dotnet version 2.0.0-preview2-006497 and I started installing templates for peachpie by typing dotnet new -i Peachpie.Templates::* .
Then I began to create a new Peachpie console application by simply typing dotnet new peachpie-console. And I got a message that says The template "Peachpie console application" was created successfully.
But when I ran the dotnet restore command, I got the following error message:
ProjectName.msbuildproj(22,3): error MSB4020: The value "" of the "Project" attribute in element <Import> is invalid.
And obviously I cannot run the command dotnet run until I fix the build error.
I will try to find the reason what happened and I'll update this post as soon as I can.
----------------------------------------------------------------------------------------------------------------
Finally, I found a solution to this error!
I simply edited/replaced the default msbuildproj file with the following:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**/*.php" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Peachpie.Compiler.Tools" Version="0.7.0-*" />
<PackageReference Include="Peachpie.NET.Sdk" Version="0.7.0-*" PrivateAssets="Build" />
</ItemGroup>
<!-- A temporary solution, import C# Visual Studio design time targets in order to be able to load the project in Visual Studio -->
<PropertyGroup>
<CSharpDesignTimeTargetsPath Condition="'$(CSharpDesignTimeTargetsPath)'==''">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\Managed\Microsoft.CSharp.DesignTime.targets</CSharpDesignTimeTargetsPath>
</PropertyGroup>
<Import Project="$(CSharpDesignTimeTargetsPath)" Condition="Exists('$(CSharpDesignTimeTargetsPath)')" />
</Project>
Then, I typed the dotnet restore ProjectName.msbuildproj command.
Once restore is completed, you can now run your application by typing dotnet run command.
it runs in command prompt but on web it doesn't. do you have any idea about this?
ReplyDelete