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

fix loading dlls with bad paths like edgejs #42

Open
wants to merge 3 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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ TestResults
###################
*.user
*.suo

*.vs

# Logs and databases #
######################
Expand Down
2 changes: 1 addition & 1 deletion Source/Xipton.Razor.Example/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@
</xipton.razor>
</xipton.razor.config>

<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
5 changes: 2 additions & 3 deletions Source/Xipton.Razor.Example/Xipton.Razor.Example.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xipton.Razor.Example</RootNamespace>
<AssemblyName>Xipton.Razor.Example</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
Expand Down Expand Up @@ -40,8 +40,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.5\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
Expand Down
2 changes: 1 addition & 1 deletion Source/Xipton.Razor.Example/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.5" targetFramework="net45" />
</packages>
2 changes: 1 addition & 1 deletion Source/Xipton.Razor.UnitTest/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@
</xipton.razor>
</xipton.razor.config>

<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
7 changes: 3 additions & 4 deletions Source/Xipton.Razor.UnitTest/Xipton.Razor.UnitTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xipton.Razor.UnitTest</RootNamespace>
<AssemblyName>Xipton.Razor.UnitTest</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
Expand Down Expand Up @@ -40,8 +40,7 @@
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.5\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -62,10 +61,10 @@
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="legacy\web.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xipton.Razor\Xipton.Razor.csproj">
Expand Down
2 changes: 1 addition & 1 deletion Source/Xipton.Razor.UnitTest/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.5" targetFramework="net45" />
</packages>
16 changes: 16 additions & 0 deletions Source/Xipton.Razor.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>reactiveui-core</id>
<version>3.1.1</version>
<description>Razor machine</description>
<authors>jlamfers</authors>
<projectUrl>https://github.com/jlamfers/RazorMachine</projectUrl>
<licenseUrl>http://opensource.org/licenses/ms-pl.html</licenseUrl>
<language>en-us</language>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
</metadata>
<files>
<file src="Xipton.Razor\bin\release\*.dll" target="lib" />
</files>
</package>
2 changes: 1 addition & 1 deletion Source/Xipton.Razor/Config/RazorConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ private void FindAssemblyFileNamesByPattern(string pattern, IEnumerable<Assembly
referencedAssemblyFileNames.AddRange(
domainAssemblies
.Select(assembly => assembly.GetFileName())
.Where(filename => filename.EndsWith(pattern.Substring(1), StringComparison.OrdinalIgnoreCase))
.Where(filename => filename != null && filename.EndsWith(pattern.Substring(1), StringComparison.OrdinalIgnoreCase))
);
}
}
Expand Down
15 changes: 11 additions & 4 deletions Source/Xipton.Razor/Extension/AssemblyExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,24 @@ public static class AssemblyExtension
{
public static string GetFileName(this Assembly assembly)
{

try
{
#if __MonoCS__
return assembly == null
? null
: new DirectoryInfo(IsNotWindows ? assembly.CodeBase.Replace("file:///", "/") : assembly.CodeBase.Replace("file:///", string.Empty)).FullName;
#else
return assembly == null
? null
: new DirectoryInfo(assembly.CodeBase.Replace("file:///", string.Empty)).FullName;
return assembly == null || assembly.CodeBase.Contains("?")
? null
: new DirectoryInfo(assembly.CodeBase.Replace("file:///", string.Empty)).FullName;
#endif

}
catch(Exception ex)
{
throw new Exception(assembly.CodeBase);
}

}

public static bool IsNotWindows
Expand Down
7 changes: 3 additions & 4 deletions Source/Xipton.Razor/Xipton.Razor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xipton.Razor</RootNamespace>
<AssemblyName>Xipton.Razor</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down Expand Up @@ -45,8 +45,7 @@
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll</HintPath>
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.5\lib\net45\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
Expand Down Expand Up @@ -110,10 +109,10 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="legacy\web.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
<None Include="Xipton.Razor.Overview.cd" />
</ItemGroup>
<ItemGroup />
Expand Down
2 changes: 1 addition & 1 deletion Source/Xipton.Razor/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.2.5" targetFramework="net45" />
</packages>