Search code examples
autorest

Autorest client generation multiple references of newtonsoft


Currently i am trying to build an autogenerating client on every time i release a new api.

I've got this running i can create the project and generate files from autorest.exe and everything works fine on my machine.

However when i try to replicate the same process on the buildserver i build my sln, and once i pack i get this error:

[pack] 'Microsoft.Rest.ClientRuntime' already has a dependency defined for 'Newtonsoft.Json'.

I have added this to my csproj file to pick up on the generated files, and this works fine on my local machine.

<Compile Include="Generated\*.cs" />
<Compile Include="Generated\Models\*.cs" />

I also tried including referenced projects on the build server like so

-IncludeReferencedProjects

After a couple of days im kind of stuck here, i have been having trouble finding docs on how to actually build the autorest generated client code, if anyone knows of some please share :)

Any help appreciated :)


Solution

  • The answer here was to update nuget on teamcity from 3.2.0 to 3.4.3 then the solution would build and run the files, i am still not sure what changed since this couldnt build, but somehow with 3.2.0 i had 2 references to newtonsoft within Microsoft.rest.clientruntime, when i updated it went away.