/linkresource is a csc option that allows to link an assembly to its unmanaged dependencies. When the managed assembly is added to the GAC, the dependencies are placed in the same folder. This is how all the .NET wrappers should be installed...
There is very little information on how to do this in Visual Studio. There is no official answer, just people that hacked a solution. For example http://www.netframeworkdev.com/msbuild/msbuild-linkresource-nonassembly-external-file-beforecompile-24358.shtml. This used to work on VS2008 but it looks like it doesn't work on VS2010... :-/
Does VS2010 support LinkResources in a simple and clean way?
Thanks in advance, aalmada
I managed to get this to work in vs2010 albeit with warnings.
1) Override CoreCompile to add LinkResources
2) Add a target to get the equivalent of Copy Local on anything added as
<LinkResource Include="native.dll" />
3) If the project containing the native libraries/file only contains those files, add a type/interface. Use this type in the project using the references. I.e. the project where you use DllImport. The prevents the compiler optimising out the project dependency.
4) Tack on Alex Yakunin's trick to copy project dependencies.
This pulls all the dependencies into my $(TargetDir) ready for debugging.
In the project files I import the magic after the regular targets files ala
And I have a CopyDependencies.targets as follows: