Posts tagged NuGet

In December 2015, SharpDX 3.0.0 was released, followed by 3.0.1 in January 2016. This new version features several major changes, as well as some new features. For example, the assemblies are now more light weight by for example moving mathematics to a separate assembly. SharpDX now also supports Direct3D12 (requires Windows 10).

What’s removed and when shouldn't I upgrade?

But while Direct3D12 is now present, Direct3D10 has been removed, along with the toolkit. SharpDX 3.0.0 also requires .NET 4.5, so if you can’t use that, you will have to stay on 2.6.3. Some pretty nice helper functions, such as Texture.FromFile(...), which allowed easy loading of textures from files are also no longer supported (I will cover how to load textures in a later tutorial).

So, as we are geeks who always wants the latest and greatest we will from now on use SharpDX 3.0.1. Below are the steps on how to upgrade the Part 4 tutorial project to SharpDX 3.0.1:

  1. Open the solution in Visual Studio.
  2. Go to “Tools” -> “NuGet Package Manager” -> “Package Manager Console” to open the NuGet console.

     
  3. Enter the following command:
    Update-Package SharpDX.Direct3D11 -Version 3.0.1
    You should get an ouput similar to this:

    This will also update SharpDX and SharpDX.DXGI to 3.0.1, because SharpDX.Direct3D11 depends on those.
     
  4. Now we also have to update SharpDX.D3DCompiler, using the following command:
    Update-Package SharpDX.D3DCompiler -Version 3.0.1
     
  5. We will now be at version 3.0.1, but if you try to build you will get several compiler errors:

    This is because all math has moved into a separate assembly, SharpDX.Mathematics, and RenderForm has moved into the SharpDX.Desktop assembly, so we have to install those as well. So run the following two commands in the NuGet console:
    Install-Package SharpDX.Mathematics -Version 3.0.1
    Install-Package SharpDX.Desktop -Version 3.0.1

     
  6. Build the project again, it should now compile and run correctly, but now with SharpDX 3.0.1.

NuGet says there are no updates are available?

This happened for me as well first, if NuGet gives the error message:

No updates available for ‘SharpDX.Direct3D11’ in project ‘MySharpDXGame’.

Then you will probably have to clear the NuGet cache. Use the following steps:

  1. Go to “Tools” -> “Options…”
  2. Open “NuGet Package Manager” tab
  3. Click “Clear Package Cache”

     
  4. Re-run the commands in the console, it should now update correctly.

This concludes tutorial 4.5. All the tutorial sources on GitHub have now already been updated to SharpDX 3.0.1, so if you download the code there you won’t have to do those steps yourself.