title: Dependency injection in a project that can be used by other projects in a solution
body: <p>I have a visual studio solution which includes multiple projects (Hosts.Project1, Hosts.Project2):</p>
  
  <p><a href="https://i.stack.imgur.com/hQ2Zk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hQ2Zk.png" alt="enter image description here"></a></p>
  
  <p>The startup class in each of these project solutions looks as follows:</p>
  
  <pre><code>        public class Startup : FunctionsStartup
          {
            private IConfigurationRoot _configuration;
            public override void Configure(IFunctionsHostBuilder builder)
            {
              var serviceProvider = builder.Services.BuildServiceProvider();
              var configurationRoot = serviceProvider.GetService&lt;IConfiguration&gt;();
              var configurationBuilder = new ConfigurationBuilder();
              var azureServiceTokenProvider = new AzureServiceTokenProvider();
              var keyVaultClient = new KeyVaultClient(
                  new KeyVaultClient.AuthenticationCallback(
                      azureServiceTokenProvider.KeyVaultTokenCallback));
  
              configurationBuilder.AddConfiguration(configurationRoot);
              configurationBuilder.AddAzureKeyVault($"https://{configurationRoot["keyVaultName"]}.vault.azure.net/", keyVaultClient, new DefaultKeyVaultSecretManager());
  
              _configuration = configurationBuilder.Build();
              builder.Services.Replace(ServiceDescriptor.Singleton(typeof(IConfiguration), _configuration));
  
              builder.Services.AddSingleton&lt;IARepo, ARepo&gt;();
              builder.Services.AddSingleton&lt;IBRepo, BRepo&gt;();
              builder.Services.AddSingleton&lt;ILogRepo, LogRepo&gt;();
          }
      }
  </code></pre>
  
  <p>Each of these project solutions require "keyVaultName", access to "LogRepo". Only the following section differs in each startup class:</p>
  
  <pre><code> builder.Services.AddSingleton&lt;IARepo, ARepo&gt;();
   builder.Services.AddSingleton&lt;IBRepo, BRepo&gt;();
  </code></pre>
  
  <p>How do I create a new project solution (Hosts.ProjectCommon) which includes a common startup class (with keyVaultName, acces to LogRepo) and I can refer to this common startup class from other project solutions &amp; reuse the common startup class and only update the dependency injection code in individual project solutions?</p>