Reputation: 465
I have a .NET project that produces DLL X. This project references a third party DLL Y. X is referenced in a WCF project that produces DLL Z. I can only deploy X and Z on the server, so I added Y as an embedded resource Inside a folder called Resources to the WCF project Z and changed the web.config file as follows :
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Y" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed"/>
<codeBase version="8.0.0.0" href="Resources/Y.dll"/>
</dependentAssembly>
</assemblyBinding>
At runtime, the project can't find the Y.dll file and I get the System.IO.FileNotFoundException exception.
What can I change to make this work?
Upvotes: 0
Views: 146
Reputation: 1269
You can't embed an assembly and expect it to be referenced. you will have to deploy it to the bin folder. So the change you need to make is have all 3 dlls deployed in the sam folder.
the only possible way to load the file from embedded resource - it has to be used reflectively, which will not work in your case as you are X.dll is dependent on Y.dll
Assembly.GetExecutingAssembly().GetManifestResourceStream(...)
Upvotes: 1