GVKun编程网logo

rebar.config的依赖包名称问题(relabel_configs)

12

在本文中,您将会了解到关于rebar.config的依赖包名称问题的新资讯,同时我们还将为您解释relabel_configs的相关在本文中,我们将带你探索rebar.config的依赖包名称问题的奥

在本文中,您将会了解到关于rebar.config的依赖包名称问题的新资讯,同时我们还将为您解释relabel_configs的相关在本文中,我们将带你探索rebar.config的依赖包名称问题的奥秘,分析relabel_configs的特点,并给出一些关于.NET Core 中的命名问题:Startup 中的 ConfigureServices 与 Configure、angularjs – 如何注入依赖到module.config(configFn)在角、ASP.NET(C#)应用程序配置文件app.config/web.config的增、删、改操作、asp.net-mvc-4 – 在MVC中的App_Start()文件夹中使用AuthConfig,BundleConfig,FilterConfig,RouteConfig和WebApiConfig的实用技巧。

本文目录一览:

rebar.config的依赖包名称问题(relabel_configs)

rebar.config的依赖包名称问题(relabel_configs)

问题出在rebar,rebar3没测试。

今天用rebar管理项目,在添加一个类库时遇到问题,类库地址为:

https://github.com/tonyg/erlang-rfc4627

rebar.config里面这么写:

{deps, [
	{erlang-rfc4627, ".*", {git, "git://github.com/tonyg/erlang-rfc4627.git", "master"}},
]}.

这样写不行,查了很久,才发现问题出在erlang-rfc4627这个字段。

使用erlang读取文件:

$erl
1>file:consult("rebar.config").
{error,{5,erl_parse,"bad term"}}

原因很可能是,erlang中的原子不以-符号连接,erlang-rfc4627可以改名为erlang_rfc4627,或者''erlang-rfc4627''。

改为erlang_rfc4627继续。

获取所有依赖还是失败,失败原因:

{name_mismatch,...
    {expected,erlang_rfc4627},
    {has,rfc4627_jsonrpc}}}.

参考:Respository Name and application name conflicts

这是因为ebin/rfc4627_jsonrpc.app写着:

{application, rfc4627_jsonrpc,
 ...}.

而rebar下载的目录名称为erlang_rfc4627, 跟rfc4627_jsonrpc不匹配。

最后改为:

{deps, [
	{rfc4627_jsonrpc, ".*", {git, "git://github.com/tonyg/erlang-rfc4627.git", "master"}}
]}.

名称改为app中的项目名称即可。

.NET Core 中的命名问题:Startup 中的 ConfigureServices 与 Configure

.NET Core 中的命名问题:Startup 中的 ConfigureServices 与 Configure

一直不喜欢 Startup 中这两个可读性很比较差的糟糕命名 ConfigureServicesConfigureConfigureServices 用于配置依赖注入以在运行时根据依赖关系创建对象,Configure 用于配置中间件(middleware)以构建请求处理流水线。

今天写代码写累后散步时思考了这两个命名问题,突然想到一个成语排兵布阵ConfigureServices排兵Configure布阵。如果对应公司运营,ConfigureServices 就是给工作岗位安排人员,Configure 是制定工作流程。

根据排兵布阵,想到的英文命名是 ArrangeOrganize ,使用这2个命名改造后的 Starup 变成了这样:

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        Arrange(services);
    }

    public void Arrange(IServiceCollection services)
    {
        services.AddControllersWithViews();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        Organize(app, env);
    }

    public void Organize(IApplicationBuilder app, IWebHostEnvironment env)
    {
        var builder = env.IsDevelopment() ? app.UseDeveloperExceptionPage() : 
            app.UseExceptionHandler("/Home/Error");            

        app.UseStaticFiles();

        app.UseRouting();

        app.UseAuthorization();

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapDefaultControllerRoute();
        });
    }
}

angularjs – 如何注入依赖到module.config(configFn)在角

angularjs – 如何注入依赖到module.config(configFn)在角

在角度,我们可以注入$ routeProvider到配置功能
module.config(function ($routeProvider) {


});

我想把我的服务注入它

module.config(function ($routeProvider,myService) {


});

我确信服务被正确定义,但它抛出一个异常说未知的myService,事件我注入

module.config(function ($routeProvider,$http) {


});

它仍然说未知$ http。

你知道为什么吗?

从 Modules页,“模块加载和依赖”部分:

Configuration blocks – get executed during the provider registrations and configuration phase. Only providers and constants can be injected into configuration blocks. This is to prevent accidental instantiation of services before they have been fully configured.

Run blocks – get executed after the injector is created and are used to kickstart the application. Only instances and constants can be injected into run blocks. This is to prevent further system configuration during application run time.

所以你不能注入自己的服务,或者内置的服务像$ http到config()。改用run()。

ASP.NET(C#)应用程序配置文件app.config/web.config的增、删、改操作

ASP.NET(C#)应用程序配置文件app.config/web.config的增、删、改操作

配置文件,对于程序本身来说,就是基础和依据,其本质是一个xml文件,对于配置文件的操作,从.NET 2.0 开始,就非常方便了,提供了 System [.Web] .Configuration 这个管理功能的NameSpace,要使用它,需要添加对 System.configuration.dll的引用。
对于WINFORM程序,使用 System.Configuration.ConfigurationManager;
对于ASP.NET 程序, 使用 System.Web.Configuration.WebConfigurationManager;
对于配置文件内容的读取,真是太普遍不过了,如果你的程序里,没有读取配置文件内容的方面,你都不好意思拿出来用
我们以最常见的 AppSettings 小节来作为例子:
假设有如下的配置文件内容:
复制代码 代码如下:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="y" value="this is Y"/>
</appSettings>
</configuration>

1. 读取值:
* Asp.Net: System.Web.Configuration.WebConfigurationManager.AppSettings[“y”];
* WinForm: System.Configuration.ConfigurationManager.AppSettings[“y”];
2. 添加一项
ASP.NET(需要有写权限):
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
AppSettingsSection app = config.AppSettings;
app.Settings.Add("x","this is X");
config.Save(ConfigurationSaveMode.Modified);
WinForm:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
AppSettingsSection app = config.AppSettings;
app.Settings.Add("x","this is X");
config.Save(ConfigurationSaveMode.Modified);
3. 修改一项
* Asp.Net
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
AppSettingsSection app = config.AppSettings;
//app.Settings.Add("x","this is X");
app.Settings["x"].Value = "this is not Y";
config.Save(ConfigurationSaveMode.Modified);
* WinForm
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
AppSettingsSection app = config.AppSettings;
//app.Settings.Add("x","this is X");
app.Settings["x"].Value = "this is not Y";
config.Save(ConfigurationSaveMode.Modified);
4. 删除一项
* Asp.Net
Configuration config = WebConfigurationManager.OpenWebConfiguration(null);
AppSettingsSection app = config.AppSettings;
app.Settings.Remove("x");
config.Save(ConfigurationSaveMode.Modified);
* WinForm
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
AppSettingsSection app = config.AppSettings;
app.Settings.Remove("x");
config.Save(ConfigurationSaveMode.Modified);

您可能感兴趣的文章:

  • asp.net(c#)动态修改webservice的地址和端口(动态修改配置文件)
  • C# 读取指定路径配置文件的方法
  • C#访问应用程序配置文件的方法
  • c#读写ini配置文件示例
  • C# WinForm开发中使用XML配置文件实例
  • C#中读取App.config配置文件代码实例
  • C#配置文件Section节点处理总结
  • C#针对xml基本操作及保存配置文件应用实例
  • C#为配置文件加密的实现方法
  • C#配置文件操作类分享

asp.net-mvc-4 – 在MVC中的App_Start()文件夹中使用AuthConfig,BundleConfig,FilterConfig,RouteConfig和WebApiConfig

asp.net-mvc-4 – 在MVC中的App_Start()文件夹中使用AuthConfig,BundleConfig,FilterConfig,RouteConfig和WebApiConfig

你能详细解释一下,在MVC4中使用App_Start()文件夹吗?
我看到这个文件夹实际上在以前版本的MVC中不可用。
此文件夹中有5个文件。

> AuthConfig
> BundleConfig,
> FilterConfig,
> RouteConfig,
> WebApiConfig。

提前致谢。

解决方法

App_Start只是将ASP.NET MVC配置分组在一起的另一个文件夹,在以前的版本中,ASP.NET MVC是在Global.asax中完成的。

ASP.NET MVC引入了越来越多的配置元素,这个文件夹是放置这个配置的理想选择。例如,MVC 5的新认证。配置,如第三方登录提供商,也被放置在该文件夹(在Startup.Auth.cs中)。

App_Start不是ASP.NET / IIS认可的ASP.NET special folder。如果需要,您可以重命名该文件夹。该名称只是一个惯例,如App_GlobalResouces等

更新:

以下是每个文件的一些信息和参考点。使用这些文件非常简单。我已经包括很少的在线参考,可能会帮助您了解更多。

> AuthConfig – 注册外部认证提供者。
有关更多信息,请参阅ASP.NET MVC external authentication providers。
> BundleConfig – 注册您的CSS和JS,以便它们可以捆绑和最小化。参见ASP.NET MVC: Guidance: Bundling and Minification。
> WebApiConfig – 仅适用于您使用Web API.它可用于配置特定于Web API的路由,任何Web API设置和Web API服务。参见configuring ASP.NET MVC Web API 2
> FilterConfig – 注册的全局过滤器。这些过滤器适用于所有操作和控制器。参见ASP.NET MVC 3: Global action filters> RouteConfig – 你已经找到了信息。

我们今天的关于rebar.config的依赖包名称问题relabel_configs的分享就到这里,谢谢您的阅读,如果想了解更多关于.NET Core 中的命名问题:Startup 中的 ConfigureServices 与 Configure、angularjs – 如何注入依赖到module.config(configFn)在角、ASP.NET(C#)应用程序配置文件app.config/web.config的增、删、改操作、asp.net-mvc-4 – 在MVC中的App_Start()文件夹中使用AuthConfig,BundleConfig,FilterConfig,RouteConfig和WebApiConfig的相关信息,可以在本站进行搜索。

本文标签:

上一篇freebsd安装vim的经历(freebsd 安装)

下一篇When You Get A GPG Error Updating Your System