Thanks Rajiv. If you look at the CompositionException, what does the Description say for each of the Issues in the Issues collection? I'm hoping it should be verbose enough to understand where there's export not found or another issue with composition.
BTW - I think your choice of contract type is a bit unusal, however something like this should work:
public class Foo
{
[Export(typeof(int))]
public String providedCaption
{
get { return DateTime.Today.ToString(); }
}
}
public class Bar
{
[Import(typeof(int))]
public String providedCaption { get; set; }
}
class Program
{
static void Main(string[] args)
{
var container = new CompositionContainer();
var bar = new Bar();
container.AddComponents(new Foo(), bar);
container.Bind();
Console.WriteLine(bar.providedCaption);
Console.ReadLine();
}
}
Alex Bulankou, Microsoft Corporation. This posting is provided "AS IS".