Print Page | Close Window

Migration to DF 7.2 and Postsharp 3

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2012
Forum Discription: For .NET 4.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4220
Printed Date: 06-Sep-2025 at 2:48pm


Topic: Migration to DF 7.2 and Postsharp 3
Posted By: kdev
Subject: Migration to DF 7.2 and Postsharp 3
Date Posted: 10-Jul-2013 at 1:20pm
Hi,

I spent my day trying to migrate my solution from the previous version of DF & Cocktail to the newest one.

Postsharp throw an exception during the compilation and I have no clue why since all was working before.

I get this error for every .xaml file located in the different Silverlight Application of my solution :

Could not load file or assembly 'PostSharp, Version = 3.0.31.3, Culture = neutral, PublicKeyToken = b13fd38b8f9c99d7' or one of its dependencies. The specified file was not found.
File : xxx.xaml

Currently, only my Domains (.net & .SL) have the Ideablade.AOP and Postsharp refercence. So why do I get this error on the views ?
The references looks correct in my Domain's csproj.

I did look in the log (mode diagnostic) but it was no help.

Have you experienced such problem ?

Regards



Replies:
Posted By: sbelini
Date Posted: 10-Jul-2013 at 2:08pm
In the Domain projects, did you update PostSharp to the latest 3.0.31?
Can you double check if PostSharp package is not really installed in the views projects?


Posted By: kdev
Date Posted: 10-Jul-2013 at 2:54pm
Hi Silvio,

Yes I double checked, I have no references to Postsharp in projects hosting the views.

As for the Domain they are using postsharp 3.0.31. No reference to postsharp 2.1.* are left in the projects.


Posted By: kdev
Date Posted: 11-Jul-2013 at 4:40am
Hi,

I managed to modify TempHire to get this error ( uploads/1623/TempHire.zip - uploads/1623/TempHire.zip )

I added 2 libraries, DomainBase and DomaineBase.SL to host the EntityBase class (this is actually how my project looks like).
The references to Devforce&Postsharp on DomainBase.SL are set to CopyLocal = False.

If you build this project, the first build might success but the next  build will fail.


The problem seems to be related to CopyLocal = False in this architecture !


About my project : it discover modules at runtime, each module having his own model. Each model inherit of this DomainBase class to share the EntityBase.
To reduce the size of the XAP, I set copy local = False to every module containing in a module XAP. Only the Main application have the CopyLoca  = true on  Devforce and Postsharp. That way I donwload Defvorce libraries only once.




Posted By: kimj
Date Posted: 11-Jul-2013 at 6:40pm

When an SL project containing XAML is built there's a step called MarkupCompilePass1 which tries to compile the xaml.  It doesn't do a very good job resolving references to dependent assemblies and will raise this error.  We've seen this problem in WPF projects too.  I'm not sure why you weren't also seeing it when using PostSharp 2.0.

Setting CopyLocal=true is one fix, as that will allow the compile to work, at the cost of the increased XAP size.
 
Another workaround is to add the PostSharp.dll assembly reference, with CopyLocal=false, to your UI project(s).  You only need to add the assembly reference, not install the PostSharp package to the project.


Posted By: kdev
Date Posted: 12-Jul-2013 at 12:31am
I don't see how I can add the reference to postsharp wihtout adding the nuget package to the project if I want it to be updated on the future DF releases.

Anyway I will try this workaround thanks.



Print Page | Close Window