Running "nuget restore" during project building

Ask general questions here.
sergii
Posts: 30
Joined: Fri Jun 07, 2013 11:07 pm

Running "nuget restore" during project building

Post by sergii » Thu Apr 20, 2017 9:26 pm

Recently we have moved all our Dlls and other binaries out of github.
All the dependencies/references now stored in packages.config file.
Sample:

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Google.Apis.Gmail.v1" version="1.25.0.825" targetFramework="net451" />
  <package id="NUnit" version="3.6.1" targetFramework="net451" />
  <package id="System.Threading.Tasks.Extensions" version="4.3.0" targetFramework="net451" />
</packages>
We added the following line to gitignore as well:

Code: Select all

/path_to_root/packages/
Now each time we make a clean pull, we need to right click on References and select "Restore packages" to trigger Nuget restore.

Is there a way to make Nuget restore part of the regular "Build->Build" functionality?

Side question: do you guys think this is optimal approach or something can be improved.

My only concern that sometimes my .rxtst files is being modified. From this:

Code: Select all

 <references> 
    <reference> 
      BouncyCastle.Crypto.dll 
    </reference> 
     <reference> 
      Google.Apis.Gmail.v1.dll 
    </reference> 
  </references> 
</testsuitedoc> 
To this:

Code: Select all

    <reference> 
      BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=0e99375e54769942 
    </reference> 
     <reference> 
      Google.Apis.Gmail.v1, Version=1.25.0.825, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL 
    </reference> 
  </references> 
</testsuitedoc> 
Which might be not the best idea in my opinion, but it's really hard to revert it from one of the main files in Ranorex.

User avatar
N612
Posts: 62
Joined: Mon Jul 11, 2016 4:01 pm

Re: Running "nuget restore" during project building

Post by N612 » Tue Apr 25, 2017 7:12 pm

Using the Nuget.exe CLI, you can perform a package restore to your solution as a pre-build step (right click project > properties > build events tab). Check out the link below for more information.

http://www.cazzulino.com/ultimate-cross ... store.html

Regarding the modified rxtst file, does this cause any issues with your test?