SL4 Support

Nov 30, 2009 at 7:18 PM

Howdy,

This is the error I get when adding references to all the dll's when in SL4 - VS2010.

Thoughts?

 

Cheers

 

Error 1 The "ValidateXaml" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'file:///G:\Silverlight - MediaFramework\smf-41973\Source\Trunk\Microsoft.SilverlightMediaFramework\Microsoft.SilverlightMediaFramework.Player\Bin\Debug\Microsoft.Web.Media.SmoothStreaming.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///G:\Silverlight - MediaFramework\smf-41973\Source\Trunk\Microsoft.SilverlightMediaFramework\Microsoft.SilverlightMediaFramework.Player\Bin\Debug\Microsoft.Web.Media.SmoothStreaming.dll' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask task)
   at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask task)
   at Microsoft.Silverlight.Build.Tasks.ValidateXaml.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)

 SharedControlSolution

Coordinator
Dec 1, 2009 at 7:33 PM

Hello Brennon,

I don't think your issue is related to Silverlight 4.  I have built a Player using SL4 to demonstrate and posted the source here.  Judging by the following error message it looks like your .DLLs are being loaded over network storage.  I recommend moving them locally and re-adding your references.  Please let me know if this resolves your issue.

An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch.

Thanks, Kevin.

Dec 2, 2009 at 8:27 AM

Thanks very much for your reply Kevin.

I should mention that I tried the following:

  • Clean the Solution
  • Add dll's to the local directory ("G" is on the root machine as well though)
  • Add a LoadFromRemoteSources to the web config
  • Download and run your sample - which has the same error as well. (Thanks very much for doing that)

I get the same error consistantly.

Any other thoughts?

Cheers

 

Dec 2, 2009 at 9:44 AM

To add to this, I found that this particular error was prominant with Silverlight2 Beta as well. It really isnt helpful is it?

The solution builds just fine in Blend, but VS2010 is the killer. After removing references to the SMF dll's, it all works.

Fun and games I guess.

 

Cheers

Coordinator
Dec 2, 2009 at 6:39 PM

Thanks for the information Brennon.  Are you using VS 2010 Beta 2?  Could you provide the version numbers you have for Visual Studio (help->about), Microsoft Silverlight 4 Beta SDK, and the Microsoft Silverlight 4 Tools for Visual Studio 2010 Beta 2?

These are the versions I am using:

  • Visual Studio 2010 Beta 2: 10.0.21006.1 B2Rel
  • Microsoft Silverlight 4 Beta SDK: 4.0.41108.0
  • Microsoft Silverlight 4 Tools for visual Studio 2010 Beta 2: 10.0.21111.00

Thanks, Kevin.

Coordinator
Dec 3, 2009 at 12:03 AM

Brennon,

A colleage of mine had the same challenge.  Here is how we fixed it:

  1. Right click on each SMF .dll file in Windows Explorer
  2. Uncheck "Read Only"
  3. Click "Unblock"

I believe this is because Windows does not initially trust files that you download from the internet.  For additional information about this: http://www.petri.co.il/unblock-files-windows-vista.htm  Please let me know if this has solved your problem.

Kevin.

Dec 3, 2009 at 8:54 AM

Legend Kevin!!

Your SL4 test solution works awesomely ;-)

I really appreciate your persistance with this and reaching out to others, please pass on my appreciation.

Beers for you lot.

 

Cheers

Jun 29, 2010 at 3:32 AM

I know this was posted a while ago but just wanted to say thanks Kevin.  I searched all over for the solution to this problem before stumbling upon your correct solution!  Much appreciated!

-Ryan

Coordinator
Jun 30, 2010 at 11:26 PM

Happy to help, would love your feedback on SMF v2RC :)

Oct 12, 2010 at 10:14 AM
Edited Oct 12, 2010 at 10:16 AM
krohling wrote:

Brennon,

A colleage of mine had the same challenge.  Here is how we fixed it:

  1. Right click on each SMF .dll file in Windows Explorer
  2. Uncheck "Read Only"
  3. Click "Unblock"

I believe this is because Windows does not initially trust files that you download from the internet.  For additional information about this: http://www.petri.co.il/unblock-files-windows-vista.htm  Please let me know if this has solved your problem.

Kevin.

Hi

 

I've tried all of these points (although I could not find a 'Unblock' button or checkbox (I'm using WinXP)). I've also tried giving Everyone Full Control over the .dlls.  And I still get the errors.

Anyone have any other ideas?

Thanks

Oct 24, 2010 at 11:03 AM

See this

You can also permanently disable this security check in Visual Studio 2010. Open the VS2010 config file at this location:

 %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config

...and add the following under the <CONFIGURATION> element:

 <runtime>
  <loadFromRemoteSources enabled="true" />
 </runtime>

 

At:

http://www.andybeaulieu.com/Home/tabid/67/EntryID/190/Default.aspx