Red Gate forums :: View topic - DependenciesSearchPaths problem. ( May I say a bug? )
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SmartAssembly 6
SmartAssembly 6 forum

DependenciesSearchPaths problem. ( May I say a bug? )

Search in SmartAssembly 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
Ognyandim



Joined: 08 Jan 2013
Posts: 10
Location: Sofia, Bulgaria

PostPosted: Mon Jan 28, 2013 2:35 pm    Post subject: DependenciesSearchPaths problem. ( May I say a bug? ) Reply with quote

Hello,
Here is the situation :
I have two projects - the first is a simple AutoCAD 2012 plug-in ( .dll ) and the other is the same simple plug-in but for AutoCAD 2013. The two dlls are using the same source code - I link 2012 code into 2013 project - that is because Autodesk decided to move things around in the dlls - AcMgd.dll, AcDbMgd,dll, AcCui.dll in AutoCAD 2012 and one more in AutoCAD 2013 called AcCoreMgd.dll. The problem comes with a specific collection which is now in extension class.

At the end I have two projects in the same solution, the second just links the code of the firsts and has almost the same references. I ave two .saproj-ects too.

Where is the problem you should ask?

The problem is that I am building these two dlls in separate project files ( .saproj ) and when I try to obfuscate them the first project created gets done and the other does not. SmartAssembly displays an error :

Quote:

SmartAssembly has encountered an invalid symbol
[Acmgd]
Autodesk.Autocad.ApplicationServices.DocumentCollectionExtension

The most likely cause is that SmartAssembly has used a different version of dependency from the version used by acadPlugin2013.dll.

If the details below are wrong, please use the mandatoryPath attribute in the .saproj to ensure that the correct version of the dependency is found.

Assembly that should contain the symbol :
[deleted]..\objectarx.2012\Acmgd.dll


And surely it does display a good error message. Look back there - "objectArx.2012"!! - I have just made a brand new .saproj and selected object.arx.2013 folder not 2012 folder when I was prompted for the dependencies of my dll.

Where is the problem? - In the fact that SA writes its dependency search folders in "C:\ProgramData\Red Gate\SmartAssembly\SmartAssembly.settings" in the <DependenciesSearchPaths> section. Why is that a problem you should ask? Because this is not a per project section but a global section that sticks to SA and not the project. And why is that a problem? Because the firs project gets "instrumented" by SA with its assemblies and for the other I get the error because the associated assemblies are not its own but these from the previous project. Even I have selected different dependency during code analysis! Why is that? I thing it is because SA looks its search paths first and stops when it finds the .dll with the specified name. But that is the wrong dll. I am asking - Why is that behavior? Why SA prompts me for a dependency and then it gets its own from its search path?

Quote:

<DependenciesSearchPaths>
<SearchPath>[some_path]\my_lugin\libs</SearchPath>
<SearchPath>[some_path]\my_lugin\libs\objectArx.2012</SearchPath>
<SearchPath>[some_path]\my_lugin\libs\objectArx.2013</SearchPath>
</DependenciesSearchPaths>


And now SA finds the AcMgd.dll in the first folder, but we need the second folder, and brings it in and BANG - dependency error as displayed above.

"Have you tried setting "MandatoryPath" property in your 2013.saproj file in order to tell SA where to get the dependency explicitly as recommended by the error message?" - Yes, that was the first thing I have done as explained here http://www.red-gate.com/supportcenter/content/SmartAssembly/help/6.7/SA_SearchingForDependencies:

[quote]
<Assembly AssemblyName="Acdbmgd, Culture=neutral, PublicKeyToken=null" MandatoryPath="..\..\..\libs\objectArx.2013\AcDbMgd.dll">
<Merging />
<Embedding />
</Assembly>
<Assembly AssemblyName="AcCui, Culture=neutral, PublicKeyToken=null" MandatoryPath="..\..\..\libs\objectArx.2013\AcCui.dll">
<Embedding />
<Merging />
</Assembly>
<Assembly AssemblyName="Acmgd, Culture=neutral, PublicKeyToken=null" MandatoryPath="..\..\..\libs\objectArx.2013\AcMgd.dll">
<Merging />
<Embedding />
</Assembly>
<Assembly AssemblyName="AdWindows, Culture=neutral, PublicKeyToken=null" MandatoryPath="..\..\..\libs\objectArx.2013\AdWindows">
<Embedding />
<Merging />
</Assembly>
<Assembly AssemblyName="AcTcMgd, Culture=neutral, PublicKeyToken=null" MandatoryPath="..\..\..\libs\objectArx.2013\AcTcMgd">
<Merging />
<Embedding />
</Assembly>
<Assembly AssemblyName="accoremgd, Culture=neutral, PublicKeyToken=null" MandatoryPath="..\..\..\libs\objectArx.2013\AcCoreMgd.dll">
<Merging />
<Embedding />
</Assembly>
[\quote]
Does it look good now? Yes, but there is something missing here - a fresh new restart of SmartAssembly. This is the point in the post when decided to try restarting it before posting. Smile I needed to restart SA and not just edit it. I edited the .saproj, but it looks like it is in the memory of the application - body told me so, neither does the error message but I guessed it and everything runs runs now.

Why SA prompts me for the dependencies of my DLL in the beginning when the code analysis happens and when I point AcMgd.dll in objectarx.2013 folder everything is great and code analysis passes and after that when I press Build SA searches in its own prerecorded folders for my previous project and not the exactly selected DLL?

A good idea is to make the DependenciesSearchPaths attribute per project and not global
in order to reduce "friction".

P.S. I really like SA and I admire the good work done on it. It saved me months in which I would have to reinvent the wheel.


Last edited by Ognyandim on Wed Jan 30, 2013 8:26 am; edited 1 time in total
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1123
Location: My desk.

PostPosted: Tue Jan 29, 2013 7:23 pm    Post subject: Reply with quote

Thanks for your post- normally, yes, we would say to use MandatoryPath in the .saProj.

I wasn't quite sure about the part where this went wrong - when you say a fresh restart of Smartassembly, do you mean with a new project, so you have to do MandatoryPath all over again? Or the changes you made to your project got lost?
Back to top
View user's profile Send private message
Ognyandim



Joined: 08 Jan 2013
Posts: 10
Location: Sofia, Bulgaria

PostPosted: Wed Jan 30, 2013 8:25 am    Post subject: Solved Reply with quote

Hello Smile
It went wrong during build. By fresh restart I mean that I closed SA and then started it. Before restarting any editing - say including of MandatoryPath - were not taken into account. Probably closing and then opening again would have done the job too, but I am not sure. I restarted it. After restart the changes were considered and the build went good.
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1123
Location: My desk.

PostPosted: Thu Jan 31, 2013 2:30 pm    Post subject: Reply with quote

Ahh, I see- so basically, you made changes to the .saProj while Smartassembly was running, but it did not see the change until re-loaded?
OK, that makes sense.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group