reactiveui / refit

The automatic type-safe REST library for .NET Core, Xamarin and .NET. Heavily inspired by Square's Retrofit library, Refit turns your REST API into a live interface.
https://reactiveui.github.io/refit/
MIT License
8.59k stars 746 forks source link

Generator throws System.IO.FileNotFoundException if RefitStubs.cs does not exist #137

Closed alexeyzimarev closed 9 years ago

alexeyzimarev commented 9 years ago

In version 2.2.1 the generator crashes with FileNotFoundException if target RefitStubs.cs (second parameter) does not exist.

Unhandled Exception: System.IO.FileNotFoundException: Could not find file 'C:\Te amCity\buildAgent\work\88ce84b2745369bc\TestProject\RefitStubs.cs'. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, I nt32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions o ptions, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea n useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detec tEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) at System.IO.File.ReadAllText(String path, Encoding encoding) at Refit.Generator.Program.Main(String[] args)

When I create an empty RefitStubs.cs file, the build works. It worked fine in 2.1, started to fail after updating to 2.2.

anaisbetts commented 9 years ago

RefitStubs.cs is added as part of the NuGet package, did you remove it by-hand?

alexeyzimarev commented 9 years ago

There are two possibilities. 1) Packages are not restored on a build server but loaded from VCS. 2) NCrunch build, no nuget restore but different output folder

Cheesebaron commented 9 years ago

Why was this closed?

alexeyzimarev commented 9 years ago

@Cheesebaron Paul is right, when nuget restore is done, the file is created. It is a bit inconvenient since it does not work when packages are restored for a project, not for the whole solution, and this is a default for Visual Studio.