我用Microsoft.AspNet.Scaffolding.12.dll编码了CodeGenerator,我可以在aspnet mvc 5中使用它(右键单击该项目并添加-> New Build Base Project),但是当我想更新它时aspnetcore,它不起作用。 那我该怎么做呢?
1。我试图使用Visual Studio SDK对其进行重写,但是对我来说是如此。
CodeGenerator主要是:
payload
请帮助我,或者告诉我Microsoft.AspNet.Scaffolding.12.dll无法在aspnetcore中使用,并建议我另一种方式,所以谢谢!
答案 0 :(得分:0)
这是解决问题的一种方法,作为工厂的子类,属性将其导出为.net核心脚手架,而IConfigurableScaffolderFactory提供了一些反馈给Visual Studio脚手架。
[Export("NetCoreScaffolderFactory", typeof(CodeGeneratorFactory))]
public class ModuleScaffolderFactoryConfig : ModuleScaffolderFactory , IConfigurableScaffolderFactory
{
/// <summary>
/// evaluate a selected code generation context
/// </summary>
/// <param name="factoryEvaluationContext"></param>
/// <returns></returns>
public bool IsEvaluationContextInitialized(IScaffolderFactoryConfigEvaluationContext factoryEvaluationContext)
{
return true;
}
/// <summary>
/// check selected code generation context is supported for selected project if yes, return true.
/// </summary>
/// <param name="factoryEvaluationContext"></param>
/// <returns></returns>
public bool IsSupported(IScaffolderFactoryConfigEvaluationContext factoryEvaluationContext)
{
return true;
}
public IScaffolderFactoryConfigEvaluationContext SetupConfigEvaluationContext(CodeGenerationContext context)
{
return null;
}
}