ManIkWeet
ManIkWeet

Reputation: 1338

Use SharpDX compiled from source?

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:

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

Upvotes: 1

Views: 830

Answers (1)

xoofx
xoofx

Reputation: 3772

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).

  • Referencing a Project B1 from a Project A1: the project B1 is considered as a separable and compilable project. All the properties and targets defined by B1 are not visible in A1.
  • Importing a project B1 into A1 is like inlining the project B1 into A1. All properties and targets defined in B1 are visible in A1 (and overriding everything that is defined before the inclusion point)

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.

Upvotes: 0

Related Questions