locked
Assembly not trusted exception while N-Unit Testing

    Frage

  • Hi,

    I am trying to test this method but I just cannot get around to run it directly or in a debug mode.It gives me the following exception on running it with teh test manager :

    "Failed to Queue Test Run xyz@ISCWS-00-883 2006-04-20 16:51:03' with id {d9a35ba4-2ef7-4675-9618-c23948673d91}: Microsoft.VisualStudio.TestTools.TestManagement.ExecutionException: Test Run deployment issue: The location of the file or directory 'c:\Solution\TestProj\bin\debug\abc.dll' is not trusted."

    The problem I feel is that the abc.dll which is required to be refered by teh method not only does not belong to this project.(TestProj) but also does not belong to this solution or application altogether.(The scene is a child application being plugged into the parent application so the dll of the parent application is required for certain objects)

    Can someone tell me how to make this dll trusted ?

    I created folder in the solution and put in the dll there which is the path i pick it up from for refering it in TestProj.

     

    Donnerstag, 20. April 2006 11:34

Antworten

  • Bit fo background firs... We do not support deployment items from networked shares that are not fully trusted. All DLLs (including the test DLL) are "deployed" implicitly, so are subject to this requirement.

    "wait, I'm not using a network share!" -- Indeed you are not. However, if you downloaded a DLL from the internet, a web site, email etc. and you saved it to disk (even when it was in a zip file), Windows XP SP2 and Win2k3SP1 will attach something called "AES" to the file on disk -- this will cause those prompts in windows that say "Are you sure?" when you try to open them from explorer. If the DLL has this extra info (stored in an NTFS Alternate Data Stream), we will report the DLL as not trusted.

     

    YOu can resolve this by finding the DLL, right clicking on it and selecting propeties. on the general tab there will be an "unblock" option. CLick this. Your test should now run fine.

    Donnerstag, 20. April 2006 16:04

Alle Antworten

  • Bit fo background firs... We do not support deployment items from networked shares that are not fully trusted. All DLLs (including the test DLL) are "deployed" implicitly, so are subject to this requirement.

    "wait, I'm not using a network share!" -- Indeed you are not. However, if you downloaded a DLL from the internet, a web site, email etc. and you saved it to disk (even when it was in a zip file), Windows XP SP2 and Win2k3SP1 will attach something called "AES" to the file on disk -- this will cause those prompts in windows that say "Are you sure?" when you try to open them from explorer. If the DLL has this extra info (stored in an NTFS Alternate Data Stream), we will report the DLL as not trusted.

     

    YOu can resolve this by finding the DLL, right clicking on it and selecting propeties. on the general tab there will be an "unblock" option. CLick this. Your test should now run fine.

    Donnerstag, 20. April 2006 16:04
  • I've run into the same problem, however, when I right click on the .dll and select properties, I have no "Unblock" option.  Any suggestions?

    ~ HLDev

    Montag, 15. Mai 2006 23:29
  • What OS? Is this on a local drive? Is the file marked as readonly?
    Donnerstag, 18. Mai 2006 20:44
  • I'm using Windows XP pro, the server is Windows Server 2003.  It is on a mapped network drive.  The file is not readonly.  I also tried logging on to the server to see if I could do it there, no luck.

    ~HLDev

    Mittwoch, 24. Mai 2006 21:59
  • You need to add the Network path as a "Full Trust" path -- we will only load an assembly when the CLR tells us the location is fully trusted. You can add this using the .net configuration wizard in Administrative Tools in control panel.
    Mittwoch, 24. Mai 2006 22:27
  • Ever automate your unit tests??  Not a whole lot of right-clicking happening on the build server.
    Mittwoch, 20. Juni 2012 23:33