0

When we download git project and click build button in VS, it restores nuget packages and then compile. always cool.

Just like that, I'd like to install Redis locally before compile because my project unit test job requires Redis.

I found Redis-64 in nuget but I don't know why it does not install properly. It displays "Redis-64 is already installed" but it's not.

There is Chocolately nuget package and Redis for chocolatey. It looks promising to utilize them.

To achieve my goal, it would be required to (1) check installation of chocolately first, and then (2) download redis-64, and then (3) execute redis-server.exe before compile process (could be placed at the Pre-build event command in .csproj property).

I want to know how to check Redis chocolatey installation and rest of other steps in VS. Would you please teach me how to achieve to do that?

Youngjae
  • 24,352
  • 18
  • 113
  • 198

2 Answers2

1

I could be way off the mark here, but the redis package that you are referring to, i.e. from NuGet should only include the assemblies that you could then consume within your application. If you actually want to have the Redis application installed, you would want to install the Redis application from Chocolatey.org, which you can find here.

In terms of getting Chocolatey etc installed as part of your build process, you might want to take a look at the build script for ChocolateGUI. As part of it's build, which is executed on AppVeyor, it checks for Chocolatey, and if it isn't there, installs it, and all required applications.

For what you want, I think you need to include:

choco install redis

Within your build script, and this will give you the redis-server.exe that you are looking for.

Gary Ewan Park
  • 17,610
  • 5
  • 42
  • 60
  • 1
    You're way off the mark here. :-) The `redis-64` NuGet package contains the actual server, `redis-server.exe`. – Edward Brey May 26 '15 at 14:27
  • Looks like you are absolutely right :-) Seems that the redis-64 package on Nuget.org is exactly the same as the package on Chocolatey.org. The only thing that Chocolatey would do in addition as part of it's install would be to create a shim for the exe, means that it could be executed from anywhere. – Gary Ewan Park May 26 '15 at 18:49
0

I installed the redis-64 NuGet package and it just worked for me. It is an unusual package in that it doesn't associate itself with any Visual Studio project, but rather it is referenced from a solution-level packages.config.

To use the Redis server in my integration test, I start the server with this code:

Process.Start(new ProcessStartInfo(Path.Combine(Directory.GetDirectories(@"..\..\..\packages", "Redis-64.*").Single(), "redis-server.exe"), "--bind 127.0.0.1") {
    WindowStyle = ProcessWindowStyle.Hidden
});
Edward Brey
  • 40,302
  • 20
  • 199
  • 253