locked
Errors after Migrating LS app to V3 RRS feed

  • Question

  • I am getting the following errors after adding the HTMLClient to a VS 2012 Upd 2 application:

    1>------ Build started: Project: Client, Configuration: Release Any CPU ------
    2>------ Build started: Project: HTMLClient, Configuration: Release Any CPU ------
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018: The "LSResourceGeneratorsTask" task failed unexpectedly.
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018: Microsoft.LightSwitch.BaseServices.InternalException: Model loading failed. Cannot cast the underlying exported value of type 'DocumentToolkit.Common.Metadata.DocumentToolkitLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'. ---> System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'DocumentToolkit.Common.Metadata.DocumentToolkitLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'.
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedLazyOfTM>b__1()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Lazy`1.CreateValue()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Lazy`1.LazyInitValue()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Lazy`1.get_Value()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.<get_ModuleLoaderExports>b__9(Lazy`2 ex)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_ModuleLoaderExports()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    --- End of inner exception stack trace ---
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_Modules()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Extensions.Internal.ModelUtilities2.GetClientModule(IModelService modelService)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.LsmlJsonConverter.GetClientModule(ProjectIdentifier pid)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.LsmlJsonConverter..ctor(ProjectIdentifier pid)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.JsonModelGenerator.GenerateArtifact()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.CodeGeneratorBase.Generate()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.CustomResultCodeGenerator.Microsoft.LightSwitch.CodeGenerator.ICodeGenerator.Generate(ProjectIdentifier pid, IDictionary`2 parameters)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeEditing.Implementation.CodeGeneratorService.RunGeneratorsImmediately(TbdCodeGeneratorType generatorType, String LightSwitchProjectType, String lightSwitchProjectSubType, String projectDirectory, IDictionary`2 parameters, IList`1 generatedFiles, IList`1& issues)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.BuildTasks.CodeGen.LSGeneratorsTask.RunGeneratorsInNonIdeScenario()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.BuildTasks.CodeGen.LSGeneratorsTask.Execute()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.BuildTasks.CodeGen.LSResourceGeneratorsTask.Execute()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
    1>  Client -> C:\5TronVSu2\VGPMMigrated\VGPM\Client\Bin\Release\VGPM.Client.dll
    1>  Begin application manifest generation
    1>  No changes detected. Application manifest file is up to date
    3>------ Build started: Project: Server, Configuration: Release Any CPU ------
    3>  Server -> C:\5TronVSu2\VGPMMigrated\VGPM\Server\bin\Release\VGPM.Server.dll
    4>------ Build started: Project: VGPM, Configuration: Release Any CPU ------
    4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.targets(108,5): error MSB3030: Could not copy the file "C:\5TronVSu2\VGPMMigrated\VGPM\HTMLClient\bin\Release\Generated\generatedAssets.js" because it was not found.
    4>Done building project "VGPM.ls3proj" -- FAILED.
    4>
    4>Build FAILED.
    ========== Build: 2 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
    

    This error showed up in the Error List:

    Error	55	Could not copy the file "C:\5TronVSu2\VGPMMigrated\VGPM\HTMLClient\bin\Release\Generated\generatedAssets.js" because it was not found.	C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.targets	108	6	VGPM
    
    Please advise.


    Garth Henderson - Vanguard Business Technology

    Thursday, April 11, 2013 9:15 PM

Answers

  • I had a similar issue with BingMapControl and LSResourceGeneratorsTask.

    It is related to the LS V1 Microsoft.Lightswitch assembly registered in GAC in  c:\Windows\assembly\ that the Control is referencing at. Due to this LSResourceGeneratorsTask seems to use this assembly instead of the new v3 one.

    Have you tried on a machine that didn't have LS v1 installed?

    I had to remove the assembly from GAC using gacutil. To do that you have first to remove the registry key of the Microsoft.Lightswitch.dll in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\Global as gacutil can't remove assemblies installed by MSI.

    Then navigate to “C:\Program
    Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools" and run gacutil /u
    Microsoft.Lightswitch.

    Please Note!

    In doing so you might not be able to use LS v1 as the assembly has been removed.

    It might be also be good to export first Microsoft.Lightswitch.dll  from GAC in the case you have to reregister it again.

    copy C:\Windows\assembly\GAC_MSIL\Microsoft.LightSwitch\10.0.0.0__31bf3856ad364e35\Microsoft.Lightswitch.dll <to a save place>.






    • Edited by mf_falkao Saturday, April 13, 2013 7:46 AM copy cmd modified
    • Marked as answer by Garth F Henderson Friday, May 3, 2013 12:18 AM
    Friday, April 12, 2013 3:18 PM
  • Adding this here as well...

    This is verified. LightSwitch 2011 (v1) installs Microsoft.LightSwitch into the GAC.  Older extensions may end up referencing that specific version. When we build for a newer project version(v3 with HTML Client), the MSBuild process takes place out of process, the extension gets loaded and the CLR will bind to the Microsoft.LightSwitch.dll(v1) assembly in the GAC, causing the build to fail. 

    mf_falkao has pointed out the workaround.  However, I would like to add that in order to keep everything working for LS2011, you should copy the v1 Microsoft.LightSwitch.dll into the IDE directory for VS 2010.

    Here are the workaround steps:

    1.       Run this command from an elevated Command Prompt:
    c:\Windows\assembly\GAC_MSIL\Microsoft.LightSwitch\10.0.0.0__31bf3856ad364e35>copy Microsoft.LightSwitch.dll "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
    1 file(s) copied.

    2.       Launch Regedit and remove this key:

    "Microsoft.LightSwitch,version=\"10.0.0.0\",publicKeyToken=\"31bf3856ad364e35\",processorArchitecture=\"MSIL\",fileVersion=\"10.0.40219.220\",culture=\"neutral\"<snipped>

    From:

    \HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\Global

    3.       Launch a Dev Command Prompt and issue a: gacutil /u Microsoft.LightSwitch

    4.       Launch your solution and compiled.  You shouldn't experience the error MSB4018: The "LSResourceGeneratorsTask" task failed unexpectedly.

    That should resolve the problem.

    Thanks,

    Tim Atkins

    Thursday, May 2, 2013 11:59 PM
  • Its not VS2010 but LS 2011 (aka LS v1) that did register Microsoft.Lightswitch.dll in GAC. VS2012 Builder finds this assembly but Microsoft.LightSwitch.Model.IModuleDefinitionLoader might have changed in the meanwhile.

    I had this problem only with old extensions. Extensions made with the VS2012 Extension Kit are not affected.

    I've also updated the copy command to "copy C:\Windows\assembly\GAC_MSIL\Microsoft.LightSwitch\10.0.0.0__31bf3856ad364e35\Microsoft.Lightswitch.dll <to a save place>" in the case you might take a backup of the dll, as the previous given one did not work.

    If you like to browse C:\Windows\assembly then the best way is to use "net use <drive:> \\<your computer name>\c$\windows\assembly.


    Saturday, April 13, 2013 7:53 AM

All replies

  • Here are the results from another project that is not using Document Toolkit:

    1>------ Build started: Project: Client, Configuration: Release Any CPU ------
    2>------ Build started: Project: HTMLClient, Configuration: Release Any CPU ------
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018: The "LSResourceGeneratorsTask" task failed unexpectedly.
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018: Microsoft.LightSwitch.BaseServices.InternalException: Model loading failed. Cannot cast the underlying exported value of type 'Luminous.Controls.ModuleLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'. ---> System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Luminous.Controls.ModuleLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'.
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedLazyOfTM>b__1()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Lazy`1.CreateValue()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Lazy`1.LazyInitValue()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Lazy`1.get_Value()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.<get_ModuleLoaderExports>b__9(Lazy`2 ex)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_ModuleLoaderExports()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    --- End of inner exception stack trace ---
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_Modules()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.Model.Extensions.Internal.ModelUtilities2.GetClientModule(IModelService modelService)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.LsmlJsonConverter.GetClientModule(ProjectIdentifier pid)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.LsmlJsonConverter..ctor(ProjectIdentifier pid)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.JsonModelGenerator.GenerateArtifact()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.CodeGeneratorBase.Generate()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeGenerator.Implementation.CustomResultCodeGenerator.Microsoft.LightSwitch.CodeGenerator.ICodeGenerator.Generate(ProjectIdentifier pid, IDictionary`2 parameters)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.CodeEditing.Implementation.CodeGeneratorService.RunGeneratorsImmediately(TbdCodeGeneratorType generatorType, String LightSwitchProjectType, String lightSwitchProjectSubType, String projectDirectory, IDictionary`2 parameters, IList`1 generatedFiles, IList`1& issues)
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.BuildTasks.CodeGen.LSGeneratorsTask.RunGeneratorsInNonIdeScenario()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.BuildTasks.CodeGen.LSGeneratorsTask.Execute()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.LightSwitch.BuildTasks.CodeGen.LSResourceGeneratorsTask.Execute()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    2>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets(208,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
    C:\5TronVSu2\VGLM\VGLM\Client\UserCode\Application.cs(22,40): warning CS0169: The field 'LightSwitchApplication.Application._timer' is never used
    
    Compile complete -- 0 errors, 1 warnings
    1>  Client -> C:\5TronVSu2\VGLM\VGLM\Client\Bin\Release\VGLM.Client.dll
    1>  Begin application manifest generation
    1>  Application manifest generation completed successfully
    3>------ Build started: Project: Server, Configuration: Release Any CPU ------
    3>  Server -> C:\5TronVSu2\VGLM\VGLM\Server\bin\Release\VGLM.Server.dll
    4>------ Build started: Project: VGLM, Configuration: Release Any CPU ------
    4>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.targets(108,5): error MSB3030: Could not copy the file "C:\5TronVSu2\VGLM\VGLM\HTMLClient\bin\Release\Generated\generatedAssets.js" because it was not found.
    4>Done building project "VGLM.ls3proj" -- FAILED.
    4>
    4>Build FAILED.
    ========== Build: 2 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
    

    Here are the Errors:

    Error	1	The "LSResourceGeneratorsTask" task failed unexpectedly.
    Microsoft.LightSwitch.BaseServices.InternalException: Model loading failed. Cannot cast the underlying exported value of type 'Luminous.Controls.ModuleLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'. ---> System.ComponentModel.Composition.CompositionContractMismatchException: Cannot cast the underlying exported value of type 'Luminous.Controls.ModuleLoader (ContractName="Microsoft.LightSwitch.Model.IModuleDefinitionLoader")' to type 'Microsoft.LightSwitch.Model.IModuleDefinitionLoader'.
       at System.ComponentModel.Composition.ExportServices.CastExportedValue[T](ICompositionElement element, Object exportedValue)
       at System.ComponentModel.Composition.ExportServices.GetCastedExportedValue[T](Export export)
       at System.ComponentModel.Composition.ExportServices.<>c__DisplayClass4`2.<CreateStronglyTypedLazyOfTM>b__1()
       at System.Lazy`1.CreateValue()
       at System.Lazy`1.LazyInitValue()
       at System.Lazy`1.get_Value()
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.<get_ModuleLoaderExports>b__9(Lazy`2 ex)
       at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_ModuleLoaderExports()
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
       --- End of inner exception stack trace ---
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.LoadItems()
       at Microsoft.LightSwitch.Model.Implementation.ModelServiceBase.get_Modules()
       at Microsoft.LightSwitch.Model.Extensions.Internal.ModelUtilities2.GetClientModule(IModelService modelService)
       at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.LsmlJsonConverter.GetClientModule(ProjectIdentifier pid)
       at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.LsmlJsonConverter..ctor(ProjectIdentifier pid)
       at Microsoft.LightSwitch.CodeGenerator.Implementation.MobileWeb.JsonModelGenerator.GenerateArtifact()
       at Microsoft.LightSwitch.CodeGenerator.Implementation.CodeGeneratorBase.Generate()
       at Microsoft.LightSwitch.CodeGenerator.Implementation.CustomResultCodeGenerator.Microsoft.LightSwitch.CodeGenerator.ICodeGenerator.Generate(ProjectIdentifier pid, IDictionary`2 parameters)
       at Microsoft.LightSwitch.CodeEditing.Implementation.CodeGeneratorService.RunGeneratorsImmediately(TbdCodeGeneratorType generatorType, String LightSwitchProjectType, String lightSwitchProjectSubType, String projectDirectory, IDictionary`2 parameters, IList`1 generatedFiles, IList`1& issues)
       at Microsoft.LightSwitch.BuildTasks.CodeGen.LSGeneratorsTask.RunGeneratorsInNonIdeScenario()
       at Microsoft.LightSwitch.BuildTasks.CodeGen.LSGeneratorsTask.Execute()
       at Microsoft.LightSwitch.BuildTasks.CodeGen.LSResourceGeneratorsTask.Execute()
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()	C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.Build.Tasks.targets	208	5	HTMLClient
    Error	3	Could not copy the file "C:\5TronVSu2\VGLM\VGLM\HTMLClient\bin\Release\Generated\generatedAssets.js" because it was not found.	C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\LightSwitch\v3.0\Microsoft.LightSwitch.targets	108	6	VGLM
    


    Garth Henderson - Vanguard Business Technology

    Thursday, April 11, 2013 9:35 PM
  • Note:  I'm now working with Jon Burchel with an open MSDN ticket on this.   I'll post our findings later.

    Garth Henderson - Vanguard Business Technology

    Thursday, April 11, 2013 10:08 PM
  • Hey guys,

    i am getting an error too. My existing V2 Project runs fine on IE10 (win 8) SL in Webbrowser 3-Tier Intrinsic Data.
    As soon as i convert my Project to V3, add a HTML Client and run the Project, the Browser throws an exception. -> Something like: FOOK, the model cannot be loaded. Error analyzing the Model-json string: Syntax Error.

    I've tried several things, but really have no clue what it's caused by, it's just not woking. Starting with a new/vanilla Project->no Problems. Any ideas?

    Greetz form Germany

    Denny

    Friday, April 12, 2013 3:59 AM
  • Aloha Denny,

    I'll definitely share what the solution was as soon as I know more.


    Garth Henderson - Vanguard Business Technology

    Friday, April 12, 2013 4:50 AM
  • Aloha Denny,

    I'll definitely share what the solution was as soon as I know more.


    Garth Henderson - Vanguard Business Technology

    Sweet, Garth,
    and thanks for the warm welcome and your interest.

    Later,
    Denny

    Friday, April 12, 2013 11:54 AM
  • I had a similar issue with BingMapControl and LSResourceGeneratorsTask.

    It is related to the LS V1 Microsoft.Lightswitch assembly registered in GAC in  c:\Windows\assembly\ that the Control is referencing at. Due to this LSResourceGeneratorsTask seems to use this assembly instead of the new v3 one.

    Have you tried on a machine that didn't have LS v1 installed?

    I had to remove the assembly from GAC using gacutil. To do that you have first to remove the registry key of the Microsoft.Lightswitch.dll in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\Global as gacutil can't remove assemblies installed by MSI.

    Then navigate to “C:\Program
    Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools" and run gacutil /u
    Microsoft.Lightswitch.

    Please Note!

    In doing so you might not be able to use LS v1 as the assembly has been removed.

    It might be also be good to export first Microsoft.Lightswitch.dll  from GAC in the case you have to reregister it again.

    copy C:\Windows\assembly\GAC_MSIL\Microsoft.LightSwitch\10.0.0.0__31bf3856ad364e35\Microsoft.Lightswitch.dll <to a save place>.






    • Edited by mf_falkao Saturday, April 13, 2013 7:46 AM copy cmd modified
    • Marked as answer by Garth F Henderson Friday, May 3, 2013 12:18 AM
    Friday, April 12, 2013 3:18 PM
  • Thanks for the advice on this, Falcao.   However, MS is not saying to unload VS Upd 1.

    I'll post a resolution when we have one.


    Garth Henderson - Vanguard Business Technology

    Friday, April 12, 2013 5:56 PM
  • It is not VS 2012 UPD1 but the old Lightswitch V1 dll from VS 2010.

    I'm pretty sure that this your problem. Did you have LS V1 installed or still installed on that machine?

    Friday, April 12, 2013 11:29 PM
  • Hey Falkao,

    hmmm . . . yes, I still have VS 2010 installed on the computer.   I assume that most developers also expect to have VS 2010 running side-by-side with VS 2012 for a while.

    I'll let you know what MS recommends to fix the problem.


    Garth Henderson - Vanguard Business Technology

    Saturday, April 13, 2013 2:21 AM
  • Its not VS2010 but LS 2011 (aka LS v1) that did register Microsoft.Lightswitch.dll in GAC. VS2012 Builder finds this assembly but Microsoft.LightSwitch.Model.IModuleDefinitionLoader might have changed in the meanwhile.

    I had this problem only with old extensions. Extensions made with the VS2012 Extension Kit are not affected.

    I've also updated the copy command to "copy C:\Windows\assembly\GAC_MSIL\Microsoft.LightSwitch\10.0.0.0__31bf3856ad364e35\Microsoft.Lightswitch.dll <to a save place>" in the case you might take a backup of the dll, as the previous given one did not work.

    If you like to browse C:\Windows\assembly then the best way is to use "net use <drive:> \\<your computer name>\c$\windows\assembly.


    Saturday, April 13, 2013 7:53 AM
  • Adding this here as well...

    This is verified. LightSwitch 2011 (v1) installs Microsoft.LightSwitch into the GAC.  Older extensions may end up referencing that specific version. When we build for a newer project version(v3 with HTML Client), the MSBuild process takes place out of process, the extension gets loaded and the CLR will bind to the Microsoft.LightSwitch.dll(v1) assembly in the GAC, causing the build to fail. 

    mf_falkao has pointed out the workaround.  However, I would like to add that in order to keep everything working for LS2011, you should copy the v1 Microsoft.LightSwitch.dll into the IDE directory for VS 2010.

    Here are the workaround steps:

    1.       Run this command from an elevated Command Prompt:
    c:\Windows\assembly\GAC_MSIL\Microsoft.LightSwitch\10.0.0.0__31bf3856ad364e35>copy Microsoft.LightSwitch.dll "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
    1 file(s) copied.

    2.       Launch Regedit and remove this key:

    "Microsoft.LightSwitch,version=\"10.0.0.0\",publicKeyToken=\"31bf3856ad364e35\",processorArchitecture=\"MSIL\",fileVersion=\"10.0.40219.220\",culture=\"neutral\"<snipped>

    From:

    \HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Assemblies\Global

    3.       Launch a Dev Command Prompt and issue a: gacutil /u Microsoft.LightSwitch

    4.       Launch your solution and compiled.  You shouldn't experience the error MSB4018: The "LSResourceGeneratorsTask" task failed unexpectedly.

    That should resolve the problem.

    Thanks,

    Tim Atkins

    Thursday, May 2, 2013 11:59 PM
  • Many thanks to Tim for working with others on the LS Team to confirm this.

    Garth Henderson - Vanguard Business Technology

    Friday, May 3, 2013 12:17 AM
  • Tim,

    This helped me greatly.

    I have two development environments. The first one has this issue now resolved.

    However, the second development environment is presenting a Pop-up stating various ports are in use when pressing F5, or unable to connect to the LightSwitch server.

    The second development environment can successfully launch the application without the HTML Client.

    Any ideas what could be causing this behaviour?

    Roger

    Tuesday, May 28, 2013 6:58 PM