pvcbuild / pvc

PVC -- Scaffold, Build, Publish -- Composable, extensible builds in .NET created by @stirno
http://pvcbuild.com
MIT License
117 stars 11 forks source link

error while installing plugin inside a solution folder with a packages folder #76

Closed luisrudge closed 10 years ago

luisrudge commented 10 years ago

When i try to install a plugin inside a solution folder that has a packages folder, it crashes (but still creates the pvc-packages folder).

First, on an empty folder:

c:\pvcabc>dir
 Volume in drive C has no label.
 Volume Serial Number is EA30-4BF4

 Directory of c:\pvcabc

29/05/2014  23:21    <DIR>          .
29/05/2014  23:21    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  30.469.824.512 bytes free

c:\pvcabc>pvc install pvc.less
[pvc] Installed: pvc.less

Now, on a solution folder

c:\pvctest>dir
 Volume in drive C has no label.
 Volume Serial Number is EA30-4BF4

 Directory of c:\pvctest

29/05/2014  23:21    <DIR>          .
29/05/2014  23:21    <DIR>          ..
29/05/2014  23:18    <DIR>          packages
29/05/2014  23:19    <DIR>          PvcTest
29/05/2014  23:17               990 PvcTest.sln
29/05/2014  23:18    <DIR>          PvcTest.sln.ide
               1 File(s)            990 bytes
               5 Dir(s)  30.469.013.504 bytes free

c:\pvctest>pvc install pvc.less

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'NuGet.Core, Version=2.7.40808.167, Culture=neutral, PublicKeyToken=31bf3856ad
364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at ScriptCs.Hosting.Package.PackageContainer.FindReferences(String path)
   at ScriptCs.PackageAssemblyResolver.GetPackages(String workingDirectory)
   at ScriptCs.PackageAssemblyResolver.GetAssemblyNames(String workingDirectory)
   at ScriptCs.AssemblyResolver.GetPackageAssemblies(String path)
   at ScriptCs.AssemblyResolver.GetAssemblyPaths(String path)
   at ScriptCs.RuntimeServices.CreateContainer()
   at ScriptCs.RuntimeServices.GetScriptServices()
   at ScriptCs.ScriptServicesBuilder.Build()
   at Pvc.CLI.Executor.CreateScriptCsEnv(String scriptName)
   at Pvc.CLI.Commands.InstallCommand.Execute(String[] args, Dictionary`2 flags)
   at Pvc.CLI.ArgumentHandler.<>c__DisplayClassb.<Parse>b__3()
   at Pvc.CLI.Program.Main(String[] args)

c:\pvctest>dir
 Volume in drive C has no label.
 Volume Serial Number is EA30-4BF4

 Directory of c:\pvctest

29/05/2014  23:21    <DIR>          .
29/05/2014  23:21    <DIR>          ..
29/05/2014  23:18    <DIR>          packages
29/05/2014  23:21    <DIR>          pvc-packages
29/05/2014  23:19    <DIR>          PvcTest
29/05/2014  23:17               990 PvcTest.sln
29/05/2014  23:18    <DIR>          PvcTest.sln.ide
               1 File(s)            990 bytes
               6 Dir(s)  30.461.960.192 bytes free

Finally, if i remove the 'packages' folder, it runs ok again:

c:\pvctest>dir
 Volume in drive C has no label.
 Volume Serial Number is EA30-4BF4

 Directory of c:\pvctest

29/05/2014  23:26    <DIR>          .
29/05/2014  23:26    <DIR>          ..
29/05/2014  23:19    <DIR>          PvcTest
29/05/2014  23:17               990 PvcTest.sln
29/05/2014  23:18    <DIR>          PvcTest.sln.ide
               1 File(s)            990 bytes
               4 Dir(s)  30.463.938.560 bytes free

c:\pvctest>pvc install pvc.less
[pvc] Installed: pvc.less
stirno commented 10 years ago

Interesting.. I've had a similar behavior with the packages.config existing before but not the packages.

stirno commented 10 years ago

That stack trace indicates its using the built-in ScriptCs.AssemblyResolver instead of ScriptCs.PvcAssemblyResolver.. what version is your PVC CLI (I really need to add a pvc version cmd)?

Check in:

C:\Chocolatey\bin\pvc.bat
stirno commented 10 years ago

I have a repro for this. Thanks for the report!

luisrudge commented 10 years ago

Just to confirm:

C:\Chocolatey\bin\pvc.bat

@echo off
SET DIR=%~dp0%
cmd /c "%DIR%..\lib\pvc.0.0.2.2\tools\pvc.exe %*"
exit /b %ERRORLEVEL%
stirno commented 10 years ago

The base ScriptCs resolvers were still being used during initialization so it was loading stuff that PVC just doesn't care about. Fixed! :+1: