我想编写一个要在新项目(“ sdk样式”)和旧项目中都导入的msbuild“ include”(.props)文件。
有没有办法找出将.props文件导入到哪种类型的项目中,以便我可以在某种情况下使用它?例如,
<PropertyGroup Condition="'$(ProjectType)'=='sdk'">
<SomeProperty>SomeValue</SomeProperty>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud) 我在通过Castle Windsor使用xml配置注入一系列服务时遇到问题。我已经按照此链接进行了很好的解释,但是以某种方式它对我不起作用。这是我正在使用的代码:
class Program
{
static void Main(string[] args)
{
IWindsorContainer container = new WindsorContainer();
container.Install(Castle.Windsor.Installer.Configuration.FromAppConfig());
var consumer = container.Resolve<Consumer>();
}
}
public class Consumer
{
public Consumer(IFoo[] foos)
{
foreach (IFoo foo in foos)
foo.Foo();
}
}
public interface IFoo
{
void Foo();
}
public class Foo1 : IFoo
{
public void Foo() { }
}
public class Foo2 : IFoo
{
public void Foo() { }
}
Run Code Online (Sandbox Code Playgroud)
这是app.config:
<castle>
<components>
<component id="Foo1" service="Test.IFoo, Test" type="Test.Foo1, Test" …Run Code Online (Sandbox Code Playgroud)