T4 Templates Assembly load stopped functioning when I upgraded to .Net 4.8 - t4

I have a T4 template that was working when my project was using .Net 4.6.2 with the following lines in my template. I am using Visual Studio 2019.
<## template debug="false" hostspecific="true" language="C#" #>
<## assembly name="System.Core" #>
<## assembly name="$(SolutionDir)MyProject\bin\x64\Debug\MyProject.FooBar.dll" #>
<## output extension=".cs" #>
<## import namespace="System.Collections" #>
<## import namespace="System.Collections.Generic" #>
<## import namespace="System.IO" #>
<## import namespace="System.Linq" #>
<## import namespace="System.Reflection" #>
After upgrading to the whole solution to .Net 4.8 I get the following error when trying to run the template.
Severity Code Description Project File Line Suppression State
Error There was a problem loading the assembly 'C:\Repos\MyProject\bin\x64\Debug\MyProject.FooBar.dll' The following Exception was thrown:
System.BadImageFormatException: Could not load file or assembly 'file:///C:\Repos\MyProject\bin\x64\Debug\MyProject.FooBar.dll' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'file:///C:\Repos\MyProject\bin\x64\Debug\MyProject.FooBar.dll'
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, 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.VisualStudio.TextTemplating.TransformationRunner.AttemptAssemblyLoad(String assemblyName)
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Repos\MyProject\bin\x64\Debug\MyProject.FooBar.dll
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/Common7/IDE/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Users\ptaylor\AppData\Local\Microsoft\VisualStudio\16.0_9613a24e\devenv.exe.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Repos/MyProject\bin\x64\Debug\MyProject.FooBar.dll.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated. 1
I've looked around and found some similar problems in the past, but the fixes were use a fully qualified name (check) or try this fix T4 Template Could not load file or assembly 'System.Runtime, Version = 4.2.0.0' which I tried to no avail.

Related

I have added Spire.Doc from NuGet, but now getting run-time error?

i am try to implement Spire.Doc, but getting run-time error:
Could not load file or assembly 'Spire.Doc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Stack Trace:
[FileLoadException: Could not load file or assembly 'Spire.Doc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
[FileLoadException: Could not load file or assembly 'Spire.Doc, Version=6.9.11.4040, Culture=neutral, PublicKeyToken=663f351905198cb3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +21
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38
[ConfigurationErrorsException: Could not load file or assembly 'Spire.Doc, Version=6.9.11.4040, Culture=neutral, PublicKeyToken=663f351905198cb3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +738
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +217
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +92
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +290
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +549
[HttpException (0x80004005): Could not load file or assembly 'Spire.Doc, Version=6.9.11.4040, Culture=neutral, PublicKeyToken=663f351905198cb3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10074760
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
if you used other library for creating PDF or Word files, for example "Spire.PDF" , it will cause an exception like that

Why can't I build my xamarin PCL project?

First of all, sorry for my bad English. I'm developing a Xamarin PCL application for Android and UWP.
For android everything works but for UWP it doesn't. When I build in debug mode it also works fine but that is because the common language runtime exceptions are off. The errors occur when it hits Xamarin.Forms.Forms.Init(e);
These are the errors:
System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'clrcompression, Culture=neutral, PublicKeyToken=null'. Het systeem kan het opgegeven bestand niet vinden.
Source=
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'clrjit, Culture=neutral, PublicKeyToken=null'. Het systeem kan het opgegeven bestand niet vinden.
Source=
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'sqlite3, Culture=neutral, PublicKeyToken=null'. Het systeem kan het opgegeven bestand niet vinden.
Source=
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
System.IO.FileNotFoundException occurred
HResult=0x80070002
Message=Could not load file or assembly 'ucrtbased, Culture=neutral, PublicKeyToken=null'. Het systeem kan het opgegeven bestand niet vinden.
Source=
StackTrace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
The app contains multiple nuget packages and multiple portable library classes.
App PCL:
package id="Newtonsoft.Json" version="10.0.3" targetFramework="portable45-
net45+win8" /
package id="Rg.Plugins.Popup" version="1.0.4" targetFramework="portable45-
net45+win8" /
package id="SQLite.Net.Core-PCL" version="3.1.1"
targetFramework="portable45-net45+win8" /
package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-
net45+win8" /
package id="System.Runtime" version="4.3.0" targetFramework="portable45-
net45+win8" /
package id="System.Threading" version="4.3.0" targetFramework="portable45-
net45+win8" /
package id="Xam.Plugins.DownloadManager" version="1.3.2"
targetFramework="portable45-net45+win8" /
package id="Xamarin.Forms" version="2.4.0.18342"
targetFramework="portable45-net45+win8" /
package id="ZXing.Net.Mobile" version="2.2.9" targetFramework="portable45-
net45+win8" /
package id="ZXing.Net.Mobile.Forms" version="2.2.9"
targetFramework="portable45-net45+win8" /
UWP:
"Microsoft.NETCore.Platforms": "1.1.0",
"Microsoft.NETCore.UniversalWindowsPlatform": "6.0.1",
"Microsoft.Toolkit.Uwp.Notifications": "2.0.0",
"Newtonsoft.Json": "10.0.3",
"Rg.Plugins.Popup": "1.0.4",
"SQLite.Net-PCL": "3.1.1",
"SQLite.Net.Core-PCL": "3.1.1",
"System.IO": "4.3.0",
"System.Net.Sockets": "4.3.0",
"System.ObjectModel": "4.3.0",
"System.Runtime": "4.3.0",
"System.Runtime.Handles": "4.3.0",
"System.Threading": "4.3.0",
"Xam.Plugin.Connectivity": "3.0.3",
"Xam.Plugins.DownloadManager": "1.3.2",
"Xamarin.Forms": "2.4.0.18342",
"ZXing.Net.Mobile": "2.2.9",
"ZXing.Net.Mobile.Forms": "2.2.9"
Library classes 1:
PCL:
package id="Newtonsoft.Json" version="10.0.3" targetFramework="portable45-
net45+win8" /
package id="SQLite.Net.Core-PCL" version="3.1.1"
targetFramework="portable45-net45+win8" /
package id="SQLite.Net-PCL" version="3.1.1" targetFramework="portable45-
net45+win8" /
package id="Xamarin.Forms" version="2.4.0.18342"
targetFramework="portable45-net45+win8" /
UWP:
Microsoft.netcore.universalwindowsplatform
newtonsoft.json
sqlite.net-pcl
sqlite.net.core-pcl
xamarin.froms
Library classes 2:
PCL:
package id="Xamarin.Forms" version="2.4.0.18342"
targetFramework="portable45-net45+win8" /
UWP:
microsoft.netcore.universalwindowsplatform
microsoft.toolkit.uwp.notifications.
sqlite for universal windows platform
universal windows
windows desktop extensions for the uwp
windows IoT extensions for the UWP
Windows Mobile extensions for the uwp
Windows Team extensions for the uwp
xam.plugin.connectivity
xamarin.forms
Does anybody know how to fix this problem?
UPDATE:
Error 1 (clrcompression) is fixed.
This was because the base project uses an package that has an dependency of System.io.compression of version 4.1.0 and the app used 4.3.0
(but nuget packages was the same version) after I changed that it was fixed. But this can't easily be found. That's why the other 3 errors remain.

msvcp120.dll and msvcr120.dll files breaking my app After nReco.PdfGenerator adds to my bin directory

I have an asp.net mvc web application working fine before I upgraded nreco.pdfgenerator to version 1.1.10. After upgrading to version 1.1.10, whenever a pdf file is generated, the application stops working and just displays the message
Server Error in '/' Application.
Could not load file or assembly 'file:///C:\Projects\bin\msvcp120.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'file:///C:\Projects\bin\msvcp120.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'file:///C:\Projects\bin\msvcp120.dll' could not be loaded.
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\Projects\bin\msvcp120.dll
LOG: Appbase = file:///C:/Projects/
LOG: Initial PrivatePath = C:\Projects\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in LoadFrom load context.
WRN: Native image will not be probed in LoadFrom context. Native image will only be probed in default load context, like with Assembly.Load().
LOG: Using application configuration file: C:\Projects\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/Projects/bin/msvcp120.dll.
ERR: Failed to complete setup of assembly (hr = 0x80131018). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'file:///C:\Projects\bin\msvcp120.dll' or one of its dependencies. The module was expected to contain an assembly manifest.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +102
System.Reflection.Assembly.LoadFrom(String assemblyFile) +34
WebActivator.PreApplicationStartCode.Start() in D:\Code\Bitbucket\WebActivator\WebActivator\PreApplicationStartCode.cs:11
[InvalidOperationException: The pre-application start initialization method Start on type WebActivator.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'file:///C:\Projects\bin\msvcp120.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +613
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +141
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531
[HttpException (0x80004005): The pre-application start initialization method Start on type WebActivator.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'file:///C:\Projects\bin\msvcp120.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9942412
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
I've tried googling the error and found no solution anywhere.
Any help will be very much appreciated.
Not sure how to resolve the error, but I have found a workaround.
Simply set the "PdfToolPath" to a different folder to keep those bad dlls out of bin:
var pdfGenerator = new NReco.PdfGenerator.HtmlToPdfConverter
{
PdfToolPath = Path.Combine(HttpRuntime.AppDomainAppPath, "PdfTool")
};
This would cause NReco.PdfGenerator to copy the wkhtmltopdf.exe program and the 2 required dlls to the folder "PdfTool" instead.

How to get EnvDte.DTE in an assembly referenced by a T4 Template

In an assembly referenced by a T4 template using the <## assembly #> directive, I execute the code var dte = (EnvDTE.DTE)serviceProvider.GetService(typeof(EnvDTE.DTE)); which results in the following exception and stack trace.
Error 1 Running transformation: System.IO.FileNotFoundException: Could not load file or assembly 'MyProjectName.TextTemplating, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'MyProjectName.TextTemplating, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
Server stack trace:
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at System.UnitySerializationHolder.GetRealObject(StreamingContext context)
at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
at System.Runtime.Serialization.ObjectManager.DoFixups()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
at System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.FixupForNewAppDomain()
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage& smuggledMrm)
at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at System.IServiceProvider.GetService(Type serviceType)
at MyProjectName.TextTemplating.MyProjectNameTextTransformation.GetCurrentProject() in C:\Users\n1200632d\Documents\Visual Studio 2010\Projects\DataAccessLayerTests\MyProjectName.TextTemplating\MyProjectNameTextTransformation.cs:line 123
In the referenced assembly toggling the ComVisible assembly attribute either through the project's assembly properties or directly in the AssemblyInfo code file using the attribute [assembly: ComVisible(..)] appears to resolve the exception.

Help compiling a silverlight project!

Hi every body
I try to compile my project' but I get this error:
Error 1 The "ValidateXaml" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Documents and Settings\arielih\My Documents\Downloads\פרויקט\RubikCube\obj\Debug\RubikCube.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\Documents and Settings\arielih\My Documents\Downloads\פרויקט\RubikCube\obj\Debug\RubikCube.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)
RubikCube
What should I do?
If you downloaded the file RubikCube from the internet, it may be blocked. Right click on it in the explorer and "unblock it" in the file properties.

Resources