Program.cs
using System;
using RazorEngine;
namespace ConsoleApp1
{
public class Program
{
public static void Main(string[] args)
{
string template = "Hello @Model.Name! Welcome to Razor!";
string result = Razor.Parse(template, new { Name = "World" });
Console.WriteLine(result);
Console.WriteLine("Press enter to exit.");
Console.ReadLine();
}
}
}
project.json
{
"version": "1.0.0-*",
"dependencies": {
"RazorEngine": "3.4.2"
},
"commands": {
"run": "run"
},
"frameworks": {
"aspnet50": {},
"aspnetcore50": {
"dependencies": {
"System.Console": "4.0.0-beta-*"
}
}
}
}
When I run kpm build
, I get this output (included only relevant info)
Building RazerEngineTester for Asp.Net,Version=v5.0
Using Project dependency RazerEngineTester 1.0.0
Source: /Users/mason/Desktop/Dot Net Solutions/RazerEngineTester/project.json
Using Package dependency RazorEngine 3.4.2
Source: /Users/mason/.kpm/packages/RazorEngine/3.4.2
File: lib/net45/RazorEngine.dll
Building RazerEngineTester for Asp.NetCore,Version=v5.0
Using Project dependency RazerEngineTester 1.0.0
Source: /Users/mason/Desktop/Dot Net Solutions/RazerEngineTester/project.json
Using Package dependency RazorEngine 3.4.2
Source: /Users/mason/.kpm/packages/RazorEngine/3.4.2
Program.cs(2,7): error CS0246: The type or namespace name 'RazorEngine' could not be found (are you missing a using directive or an assembly reference?)
Why am I getting this compilation error even though it pulls down the RazorEngine NuGet package correctly, and according to the source code, the RazorEngine
namespace exists?
Razor
class is not inRazorEngine.Core
namespace (though it is in that folder). I don't even see aRazorEngine.Core
namespace in that project. – mason Dec 18 '14 at 1:18RazoreEngine.Core
as a dependency, and I gotUnable to locate RazorEngine.Core >= 3.4.2
. IfRazorEngine.Core
was a dependency ofRazorEngine
, wouldn't thekpm restore
automatically pull that in? – mason Dec 18 '14 at 1:22