title: "CreateRiaClientFilesTask" task failed unexpectedly
body: <p>This error has started occuring when attempting to build my VS 2010 Silverlight project after some minor changes to my RIA domain services, which are hosted within the Silverlight website application. There appears to be no reason for this error and I cannot understand the access denied part of the error.</p>
  
  <p>Things I have tried:</p>
  
  <p>1) Full clean of all projects in the solution and re-build
  2) Deletion of all temporary ASP.Net files from the framework folder
  3) Removal of linked RIA services from project properties from the class library that is failing, clean, re-build and then re-add linked RIA services</p>
  
  <p>Any advice on where to go from here would be much appreciated:</p>
  
  <p>Error   21  The "CreateRiaClientFilesTask" task failed unexpectedly.
  System.Web.HttpException (0x80004005): Could not load file or assembly 'Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied. ---> System.Configuration.ConfigurationErrorsException: Could not load file or assembly 'Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied. ---> System.IO.FileLoadException: Could not load file or assembly 'Business, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Access is denied. ---> System.IO.FileLoadException: Could not load file or assembly 'Business' or one of its dependencies. Access is denied.</p>
  
  <p>--- End of inner exception stack trace ---
     at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
     at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
     at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
     at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection)
     at System.Reflection.Assembly.Load(String assemblyString)
     at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
     --- End of inner exception stack trace ---
     at System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective)
     at System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
     at System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai)
     at System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig)
     at System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies()
     at System.Web.Compilation.BuildManager.CallPreStartInitMethods()
     at System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException)
     at System.Web.Compilation.ClientBuildManager.EnsureHostCreated()
     at System.Web.Compilation.ClientBuildManager.CreateObject(Type type, Boolean failIfExists)
     at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.CreateSharedTypeService(ClientBuildManager clientBuildManager, IEnumerable`1 serverAssemblies, ILogger logger)
     at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.GenerateClientProxies()
     at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.ExecuteInternal()
     at Microsoft.ServiceModel.DomainServices.Tools.RiaClientFilesTask.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&amp; taskResult)   Insurer.Analytics.Common</p>