We wanted to build an ASP.NET web app using the DevExpress tools but deploy it to Azure using Visual Studio Team Services CI/CD. The app ran nicely locally on the desktop but failed to build in VSTS. NuGet in the build agent claimed it couldn’t find the DevExpress packages. This is because the ‘NuGet restore’ step, by default, only uses the nuget.org repo. This is how to get better control over the repos the NuGet process in the build agent uses.
- Create a nuget.config file and add it to your solution in Visual Studio. It’ll look something like this; use your own DevExpress Feed URL…
<?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <clear /> <add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> <add key="DevExpress" value="https://nuget.devexpress.com/UseYourOwnNotOurs/api" /> </packageSources> </configuration>
2. Sync the new file to your VSTS code.
3. Edit the ‘NuGet restore’ step in your VSTS CI build…
If you run a build now, NuGet will use your nuget.config file, find the repos you specified (including the DevExpress one), retrieve the packages and build your code.
It seems to work OK for us.