Closed uzma-k closed 2 years ago
Getting below error when running - TemplateAnalyzer.exe analyze-template sample.bicep Error: An exception occurred while analyzing a template Exception details: Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzerException: Error while evaluating rules. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.Reflection.RuntimeAssembly.GetExportedTypes() at System.Reflection.Assembly.get_ExportedTypes() at System.Management.Automation.Runspaces.PSSnapInHelpers.GetAssemblyTypes(Assembly assembly, String name) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzeModuleAssemblyWithReflection(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, String helpFile, Dictionary2& cmdlets, Dictionary2& aliases, Dictionary2& providers) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Dictionary2& cmdlets, Dictionary2& aliases, Dictionary2& providers, String& helpFile) at System.Management.Automation.Runspaces.InitialSessionState.ImportPSSnapIn(PSSnapInInfo psSnapInInfo, PSSnapInException& warning) at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault() at PSRule.Host.HostState.CreateSessionState() at PSRule.Pipeline.PipelineContext.GetRunspace() at PSRule.Runtime.RunspaceContext.GetPowerShell() at PSRule.Host.HostHelper.GetPSLanguageBlocks(RunspaceContext context, Source[] sources) at PSRule.Host.HostHelper.GetLanguageBlock(RunspaceContext context, Source[] sources) at PSRule.Host.HostHelper.GetRuleBlockGraph(Source[] source, RunspaceContext context) at PSRule.Pipeline.InvokeRulePipeline..ctor(PipelineContext context, Source[] source, IPipelineWriter writer, RuleOutcome outcome) at PSRule.Pipeline.InvokePipelineBuilderBase.Build(IPipelineWriter writer) at Microsoft.Azure.Templates.Analyzer.RuleEngines.PowerShellEngine.PowerShellRuleEngine.AnalyzeTemplate(TemplateContext templateContext) at Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzer.AnalyzeTemplate(String template, String templateFilePath, String parameters) --- End of inner exception stack trace --- at Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzer.AnalyzeTemplate(String template, String templateFilePath, String parameters) at Microsoft.Azure.Templates.Analyzer.Cli.CommandLineParser.AnalyzeTemplate(FileInfo templateFilePath, FileInfo parametersFilePath)
2& cmdlets, Dictionary
2& providers) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Dictionary
2& aliases, Dictionary
run successfully
TemplateAnalyzer.exe analyze-template sample.bicep (any bicep file)
No response
Thanks for reporting @uzma-k. We are aware of this issue and are actively working on bringing a fix.
This is now resolved in Release 0.3.1
Describe the bug
Getting below error when running - TemplateAnalyzer.exe analyze-template sample.bicep Error: An exception occurred while analyzing a template Exception details: Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzerException: Error while evaluating rules. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified. File name: 'Microsoft.Management.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at System.Reflection.RuntimeAssembly.GetExportedTypes() at System.Reflection.Assembly.get_ExportedTypes() at System.Management.Automation.Runspaces.PSSnapInHelpers.GetAssemblyTypes(Assembly assembly, String name) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzeModuleAssemblyWithReflection(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, String helpFile, Dictionary
2& cmdlets, Dictionary
2& aliases, Dictionary2& providers) at System.Management.Automation.Runspaces.PSSnapInHelpers.AnalyzePSSnapInAssembly(Assembly assembly, String name, PSSnapInInfo psSnapInInfo, PSModuleInfo moduleInfo, Dictionary
2& cmdlets, Dictionary2& aliases, Dictionary
2& providers, String& helpFile) at System.Management.Automation.Runspaces.InitialSessionState.ImportPSSnapIn(PSSnapInInfo psSnapInInfo, PSSnapInException& warning) at System.Management.Automation.Runspaces.InitialSessionState.CreateDefault() at PSRule.Host.HostState.CreateSessionState() at PSRule.Pipeline.PipelineContext.GetRunspace() at PSRule.Runtime.RunspaceContext.GetPowerShell() at PSRule.Host.HostHelper.GetPSLanguageBlocks(RunspaceContext context, Source[] sources) at PSRule.Host.HostHelper.GetLanguageBlock(RunspaceContext context, Source[] sources) at PSRule.Host.HostHelper.GetRuleBlockGraph(Source[] source, RunspaceContext context) at PSRule.Pipeline.InvokeRulePipeline..ctor(PipelineContext context, Source[] source, IPipelineWriter writer, RuleOutcome outcome) at PSRule.Pipeline.InvokePipelineBuilderBase.Build(IPipelineWriter writer) at Microsoft.Azure.Templates.Analyzer.RuleEngines.PowerShellEngine.PowerShellRuleEngine.AnalyzeTemplate(TemplateContext templateContext) at Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzer.AnalyzeTemplate(String template, String templateFilePath, String parameters) --- End of inner exception stack trace --- at Microsoft.Azure.Templates.Analyzer.Core.TemplateAnalyzer.AnalyzeTemplate(String template, String templateFilePath, String parameters) at Microsoft.Azure.Templates.Analyzer.Cli.CommandLineParser.AnalyzeTemplate(FileInfo templateFilePath, FileInfo parametersFilePath)Expected behavior
run successfully
Reproduction Steps
TemplateAnalyzer.exe analyze-template sample.bicep (any bicep file)
Environment
No response