getgauge / gauge-csharp

Csharp runner for Gauge
https://gauge.org
GNU General Public License v3.0
33 stars 21 forks source link

Should restore packages by default when building project #153

Closed nvborisenko closed 5 years ago

nvborisenko commented 5 years ago
gauge run

I see:

Building project: C:\projects\example-net-gauge\Example.Gauge.csproj
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe  C:\projects\example-net-gauge\Example.Gauge.csproj /t:Build /m  /nodeReuse:False  /v:q    /p:RestorePackages="False" /p:OutputPath="C:\projects\example-net-gauge\gauge_bin" /p:Platform="Any CPU" /p:Configuration="Debug" /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" /logger:Fake.MsBuildLogger+ErrorLogger,"C:\Users\appveyor\AppData\Roaming\gauge\plugins\csharp\0.10.5\bin\FakeLib.dll"

As expected it fails with errors like:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "FluentAssertions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. [C:\projects\example-net-gauge\Example.Gauge.csproj]

It happens because of /p:RestorePackages="False"

sriv commented 5 years ago

Gauge-csharp expects packages to be restored before executing the specs. i.e. run nuget restore before gauge run specs.

Gauge uses Fake for building the project, and Fake defaults RestorePackages to false

Also, point to note - gauge allows specs to be run in parallel, in which case there are multiple gauge-csharp processes spun up. Each runner process would attempt to build the target project and that can cause conflicts at file system.

nvborisenko commented 5 years ago

If gauge expects already restored packages, make the same for building project. If I should restore packages, I should build project.

sriv commented 5 years ago

You can build the project outside gauge, set GAUGE_CUSTOM_BUILD_PATH to the location of the build output directory. When GAUGE_CUSTOM_BUILD_PATH is set, gauge-csharp will not build your project.

NivedhaSenthil commented 5 years ago

Closing this issue, feel free to open new issue if you face any problems.