Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let Nocco work in Linux (mono) environments #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Nocco/Nocco.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,13 @@ private static Type SetupRazorTemplate() {
IncludeDebugInformation = false,
CompilerOptions = "/target:library /optimize"
};
compilerParams.ReferencedAssemblies.Add(typeof(Nocco).Assembly.CodeBase.Replace("file:///", "").Replace("/", "\\"));

// Use directory separator char to determine filesystem root i.e. "/" (Linux) vs. "" (Windows)
var filesystemRoot = "";
if (Path.DirectorySeparatorChar == '/') {
filesystemRoot = "/";
}
compilerParams.ReferencedAssemblies.Add(typeof(Nocco).Assembly.CodeBase.Replace("file:///", filesystemRoot).Replace("/", Path.DirectorySeparatorChar.ToString()));

var codeProvider = new Microsoft.CSharp.CSharpCodeProvider();
var results = codeProvider.CompileAssemblyFromDom(compilerParams, razorResult.GeneratedCode);
Expand Down
8 changes: 0 additions & 8 deletions Nocco/Nocco.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,4 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>