In ResourceStaticAnalysisConfigMacroHandler
, the LoadConfigMacros()
method looks up "ResourceStaticAnalysisConfigMacros.xml"
from the directory of its assembly.Location
. This is ok when the handled is invoked from local. But when the macro handler is used in web environment, the CodeBase of the assembly and the physical location of the app instance on IIS is different...
E,g.
The Location is
C:\Users\mchen\AppData\Local\Temp\Temporary ASP.NET Files\root\cdecd0db\71a84541\assembly\dl3\389eb5b0\00c17472_911ad201\Microsoft.ResourceStaticAnalysis.Configuration.dll
The CodeBase is
File://D:/Git/QS_IRIS/Iris/src/Iris.Web/bin/Microsoft.ResourceStaticAnalysis.Configuration.dll
As a workaround, in order to make the macro handler find the xml correctly, I need to copy the macro xml file from bin folder to the physical folder where the assembly is loaded from.
If we can change the line 247 in file ResourceStaticAnalysisConfigMacroHandler.cs
from
String pathToFile = Path.Combine(Path.GetDirectoryName(assembly.Location), macroDefinitionFile);
to
String pathToFile = Path.Combine(Path.GetDirectoryName(new Uri(assembly.CodeBase).LocalPath), macroDefinitionFile);
It will resolve the issue.