Saltarelle / SaltarelleCompiler

C# to JavaScript compiler – Now http://bridge.net
http://saltarelle-compiler.com
Other
297 stars 74 forks source link

Problems using a built SCTask.dll #411

Closed sdarnell closed 9 years ago

sdarnell commented 9 years ago

I'm having problems running an updated SCTask.dll and I'm hoping you might have seen it before.

To clarify I have built the latest build on two different PCs, and get essentially the same issue (one is Win7 and the other is Win8.1). I build with (from a PowerShell window):

PS Y:\Saltarelle\build> .\psake.ps1 -properties @{configuration="Release"; skipTests=$true}

Then I copy the updated SCTask.dll from Compiler/SCTask/bin/SCTask.dll over the corresponding DLL in the packages/Saltarelle.Compiler.2.6.2.6/tools/SCTask.dll.

The problem is that when I try a build from Visual Studio (2015 CTP), I get the following error:

\\psf\Home\Documents\Web\packages\Saltarelle.Compiler.2.6.2.6\tools\Saltarelle.Compiler.targets(32,3): error MSB4062: The "SCTask" task could not be loaded from the assembly \\psf\Home\Documents\Web\packages\Saltarelle.Compiler.2.6.2.6\tools\SCTask.dll. Could not load file or assembly 'file://\\psf\Home\Documents\Web\packages\Saltarelle.Compiler.2.6.2.6\tools\SCTask.dll' or one of its dependencies. Could not find or load a specific file. (Exception from HRESULT: 0x80131621) Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

(the \psf... is because I'm actually running Win8.1 in a Parallels VM - but it has worked previously)

I believe the 0x80131621 is some sort of .net version incompatibility error.

If I change the targets file to specify runtime CLR4 and restart visual studio:

    <UsingTask AssemblyFile="SCTask.dll" TaskName="SCTask" Runtime="CLR4"/> <!--  Runtime="CLR4" -->

I get a different error:

Warning     The "SCTask" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Saltarelle.Compiler.SCTask.SCTask.Executor.Execute(Options options, TaskLoggingHelper log)
   at Saltarelle.Compiler.SCTask.SCTask.Executor.Execute(Options options, TaskLoggingHelper log)
   at Saltarelle.Compiler.SCTask.SCTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__1.MoveNext()  Engine      

I can't work out what is going wrong here or whether it is worse or better than the previous error.

I've tried to get more information by using a debug build, but that doesn't work at all.

I am able to build and run the unit tests and they pass as expected.

Any ideas?

sdarnell commented 9 years ago

I tried fuslogvw and it didn't show any errors. Would it be possible for you to send me or attach an SCTask.dll to try out from the develop branch? (the published 2.6.2 works but there have been some key issues fixed)

sdarnell commented 9 years ago

I finally got to the bottom of what I was doing wrong. It was my fault, I was copying the wrong SCTask.dll - I think it didn't have the embedded assemblies.

So, it is working again for me. Sorry, for the distraction.