Giter VIP home page Giter VIP logo

Comments (14)

beginor avatar beginor commented on May 30, 2024 3

终于彻底删掉了 Mvc 2.2 这个包袱, 轻松升级到 .net 5.0 https://github.com/beginor/SmartCode

顺便把 Handlebars 模板引擎实现也删掉了, 这个似乎没有人用。 目前只有配置文件中还用到一点。

很多时候就得做减法。

from smartcode.

beginor avatar beginor commented on May 30, 2024

同问, 现在 smartcode 使用的是 .netcore 2.2 , 这个版本不是 lts 版本, 已经过了支持期, 建议升级到 .netcore 3.1 。

from smartcode.

xiangxiren avatar xiangxiren commented on May 30, 2024

支持

from smartcode.

beginor avatar beginor commented on May 30, 2024

初略的看了一下代码, 可能是因为引用了 Host 来初始化 Razor 引擎, 导致升级到 3.x 比较困难。 可以考虑这中实现方式 https://github.com/adoconnection/RazorEngineCore 或者直接引用这个类库来替换现有的 Razor 实现 @Ahoo-Wang

from smartcode.

beginor avatar beginor commented on May 30, 2024

这里还有一篇 RazorEngineCore 的介绍 https://www.codeproject.com/Articles/5260233/Building-String-Razor-Template-Engine-with-Bare-Ha

from smartcode.

xiangxiren avatar xiangxiren commented on May 30, 2024

初略的看了一下代码, 可能是因为引用了 Host 来初始化 Razor 引擎, 导致升级到 3.x 比较困难。 可以考虑这中实现方式 https://github.com/adoconnection/RazorEngineCore 或者直接引用这个类库来替换现有的 Razor 实现 @Ahoo-Wang
将项目'SmartCode.CLI'的目标框架由netcoreapp2.2 改成netcoreapp3.1不就行了

from smartcode.

beginor avatar beginor commented on May 30, 2024

初略的看了一下代码, 可能是因为引用了 Host 来初始化 Razor 引擎, 导致升级到 3.x 比较困难。 可以考虑这中实现方式 https://github.com/adoconnection/RazorEngineCore 或者直接引用这个类库来替换现有的 Razor 实现 @Ahoo-Wang
将项目'SmartCode.CLI'的目标框架由netcoreapp2.2 改成netcoreapp3.1不就行了

不是那么简单的, 2.x 到 3.x 的升级比较复杂, 尤其是 host 这部分。 不仅很多包都没有了, 而且用法也发生了很大的变化。

from smartcode.

xiangxiren avatar xiangxiren commented on May 30, 2024

初略的看了一下代码, 可能是因为引用了 Host 来初始化 Razor 引擎, 导致升级到 3.x 比较困难。 可以考虑这中实现方式 https://github.com/adoconnection/RazorEngineCore 或者直接引用这个类库来替换现有的 Razor 实现 @Ahoo-Wang
将项目'SmartCode.CLI'的目标框架由netcoreapp2.2 改成netcoreapp3.1不就行了

不是那么简单的, 2.x 到 3.x 的升级比较复杂, 尤其是 host 这部分。 不仅很多包都没有了, 而且用法也发生了很大的变化。

呃,貌似真没那么复杂,我就是这样做的,然后打了个包放到了私有库,不一样的正常使用嘛

from smartcode.

beginor avatar beginor commented on May 30, 2024

初略的看了一下代码, 可能是因为引用了 Host 来初始化 Razor 引擎, 导致升级到 3.x 比较困难。 可以考虑这中实现方式 https://github.com/adoconnection/RazorEngineCore 或者直接引用这个类库来替换现有的 Razor 实现 @Ahoo-Wang
将项目'SmartCode.CLI'的目标框架由netcoreapp2.2 改成netcoreapp3.1不就行了

不是那么简单的, 2.x 到 3.x 的升级比较复杂, 尤其是 host 这部分。 不仅很多包都没有了, 而且用法也发生了很大的变化。

呃,貌似真没那么复杂,我就是这样做的,然后打了个包放到了私有库,不一样的正常使用嘛

这个真不一样, 得用 3.x 的 host 才算是真正的升级到了 3.x , 只改 BuildTarget 是不能算升级, 会被 @Ahoo-Wang 鄙视的

from smartcode.

xiangxiren avatar xiangxiren commented on May 30, 2024

初略的看了一下代码, 可能是因为引用了 Host 来初始化 Razor 引擎, 导致升级到 3.x 比较困难。 可以考虑这中实现方式 https://github.com/adoconnection/RazorEngineCore 或者直接引用这个类库来替换现有的 Razor 实现 @Ahoo-Wang
将项目'SmartCode.CLI'的目标框架由netcoreapp2.2 改成netcoreapp3.1不就行了

不是那么简单的, 2.x 到 3.x 的升级比较复杂, 尤其是 host 这部分。 不仅很多包都没有了, 而且用法也发生了很大的变化。

呃,貌似真没那么复杂,我就是这样做的,然后打了个包放到了私有库,不一样的正常使用嘛

这个真不一样, 得用 3.x 的 host 才算是真正的升级到了 3.x , 只改 BuildTarget 是不能算升级, 会被 @Ahoo-Wang 鄙视的

我之前改的时候,是准备把所有都升级一下,但是嫌麻烦,为了不装2.2的SDK,就简单这样改了

from smartcode.

xclw2000 avatar xclw2000 commented on May 30, 2024

不知道3.1版本现在进行到什么程度了,急呀。 @Ahoo-Wang

from smartcode.

zhan520g avatar zhan520g commented on May 30, 2024

楼主 可以考虑一个 api版本的 3.1先

from smartcode.

beginor avatar beginor commented on May 30, 2024

今天花了些时间, 用 https://github.com/adoconnection/RazorEngineCore 实现了一个新的模板引擎, 我的 fork 在这里 https://github.com/beginor/SmartCode

注意, 这个只是 Razor 引擎, 而不是完整的 MVC 的 View , 所以肯定会少一些功能。

如果要使用新的 RazorCore 模板, 需要注意的地方有:

  1. 配置文件中的 Task 需要指定 TemplateEngine 的名称 (Name) 为 RazorCore , 参考: https://github.com/beginor/SmartCode/blob/smartcode_master/doc/SmartCode-TypeScript.yml#L62 ;
  2. 模板中原来指定 @model BuildContext 修改为 @inherits SmartCode.TemplateEngine.Impl.RazorCoreTemplate<BuildContext> ;
  3. 不支持 Layout RenderPartialHtmlHelper , 这些是 MVC 的 View 才有的东西;
  4. 增加了 Include 方法, 方便使用重复的代码片段, 参考: https://github.com/beginor/SmartCode/blob/f9bbeca01ed1f624e9b51b9b5d1700bd065dbeff/src/SmartCode.Generator/RazorTemplates/TypeScript/Model.cshtml#L14
  5. 原来的 Html.PadLeft Html.NewLine 几个扩展方法移动到了 RazorCoreTemplate 方法下面, 用法 @Html.NewLine() -> @NewLine()

欲了解更多, 可以查看我这次提交的内容 beginor@f9bbeca

后续我会在我的库中删除 Hosting 以及 Mvc 这些死在 .net core 2.2 的僵尸类库, 并逐步修改现有的 Razor 模板。

from smartcode.

Ahoo-Wang avatar Ahoo-Wang commented on May 30, 2024

#62

from smartcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.