p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional C# 4.0 and .NET 4 (http://p2p.wrox.com/forumdisplay.php?f=553)
-   -   Chapter 28 Sample Code (http://p2p.wrox.com/showthread.php?t=87792)

randaljay June 20th, 2012 02:30 PM

Chapter 28 Sample Code
 
I'm looking at Chapter 28 code samples, and cannot reconcile the printed book with the downloaded code sample. Specifically, (using kindle, so please excuse the lack of page numbers!) just after snippet SimpleCalculator/Calculator.cs, the book contains "The hosting application is a simple console application". In the code I downloaded the host is a wpf app, and the code snippets that follow refer to the console app I can't seem to find. So, I tried to add my own...using Wrox.ProCSharp.MEF.Properties does not recognize properties namespace, nor does the import of the ICalculator interface work. What am I missing here? Is there any update to the code download?

Thanks for any help

ChristianNagel June 20th, 2012 03:27 PM

Quote:

Originally Posted by randaljay (Post 284830)
I'm looking at Chapter 28 code samples, and cannot reconcile the printed book with the downloaded code sample. Specifically, (using kindle, so please excuse the lack of page numbers!) just after snippet SimpleCalculator/Calculator.cs, the book contains "The hosting application is a simple console application". In the code I downloaded the host is a wpf app, and the code snippets that follow refer to the console app I can't seem to find. So, I tried to add my own...using Wrox.ProCSharp.MEF.Properties does not recognize properties namespace, nor does the import of the ICalculator interface work. What am I missing here? Is there any update to the code download?

Thanks for any help

The Properties namespace is coming from the normal Console app template. Did you change the default namespace to Wrox.ProCSharp.MEF? Then you should have the namespace Wrox.ProCharp.MEF.Properties. For the ICalculator interface, did you add a reference to the contracts-assembly?

Hope this helps

randaljay June 20th, 2012 05:08 PM

Hi, thanks for the quick response.

I botched the reference for ICalculator, quick fix, but I had to add a string property using the project properties page for AddInDirectory to force the update to app.config which was required for the properties namespace to be recoginzed.

I'm still wondering why the console host referred to in the text was not included in the sample solution I downloaded for this chapter however. The other projects I've reviewed from the downloads (though only a few to this point) fit the text in the book verbatim!

Thanks again, out of the woods here for the moment! Really getting good use out of the book too, nice job.

trishawthomas July 31st, 2013 05:38 AM

Your given reply is helps me lots to solve my problem. Thank you for this reply.


All times are GMT -4. The time now is 04:28 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.