I want to make use of the SharpDX library, a must-have is that I can compile the sourcecode myself. I can compile the latest source code from their GitHub with ease using the Net40 configuration. Now I would like to use the compiled project in my own project, I had found the following to do so: https://github.com/sharpdx/SharpDX/issues/379
This resulted in me doing the following steps:
Create file "./MyProject/Common.targets" with the following content:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- set the location of SharpDX source code -->
<SharpDXLocation Condition="'$(SharpDXLocation)' == ''">..\SharpDX</SharpDXLocation>
<!-- the new property to include references automatically (as it was in old SharpDX.targets) -->
<SharpDXIncludeReferences>true</SharpDXIncludeReferences>
<!-- (optional) override DirectX version -->
<SharpDXDirectXVersion>DirectX11</SharpDXDirectXVersion>
<!-- disable usage of signed assemblies, as you won't have the needed private key to build them -->
<SharpDXNoSigned>true</SharpDXNoSigned>
</PropertyGroup>
<Import Project="$(SharpDXLocation)\Build\SharpDX.targets" />
<Import Project="$(SharpDXLocation)\Build\SharpDX.Toolkit.targets" />
</Project>
Create file "./MyProject/SharpDXHelper.csproj" with the following content:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="BuildTarget">
<Import Project="Common.targets" />
<Target Name="BuildTarget">
<Message Text="Building command for SharpDXHelper" Importance="high" />
</Target>
<Target Name="Rebuild">
<Message Text="Rebuilding command for SharpDXHelper" Importance="high" />
</Target>
<Target Name="Clean">
<Message Text="Cleaning command for SharpDXHelper" Importance="high" />
</Target>
</Project>
If I expand the "References" part of the "./MyProject/SharpDXHelper.csproj" I see all the required references with a warning icon, the warnings are like the following:
Warning 13 The referenced component 'SharpDX' could not be found. SharpDXHelper
I don't understand what I have done wrong, why does it not find the correct components? I realize the "Toolkit" part is gone, and I expect those to fail loading, but I don't expect the others to fail.
To my understanding, I should be able to use the SharpDX library without issues if I add the "SharpDXHelper.csproj" as a dependency to any other project, am I correct on this one?
An image of the resulting problem can be found here: http://puu.sh/dfmP4/c6ac1165ed.png
To my understanding, I should be able to use the SharpDX library without issues if I add the "SharpDXHelper.csproj" as a dependency to any other project, am I correct on this one?
Not really.
A referenced project is not evaluated as an imported project (using Import task).
This is a reason why we use ".targets" extension for imported projects to differentiate them from referenced projects.
Though It may be possible to develop such a referenced Project B1 that would be able to be "copied local" by A1 when compiling A1, but this would require to dig into how .NET/C# referenced projects are getting cross-compiled in order to do this. This is feasible, but quite a challenge to develop.
I recommend you to stick with the Import solution.