Ask a questionAsk a question
 

AnswerAssembly not trusted exception while N-Unit Testing

  • Thursday, April 20, 2006 11:34 AMbizbuz Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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.

     

Answers

  • Thursday, April 20, 2006 4:04 PMdhopton MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    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.

All Replies

  • Thursday, April 20, 2006 4:04 PMdhopton MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    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.

  • Monday, May 15, 2006 11:29 PMHLDev Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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

  • Thursday, May 18, 2006 8:44 PMdhopton MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    What OS? Is this on a local drive? Is the file marked as readonly?
  • Wednesday, May 24, 2006 9:59 PMHLDev Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    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

  • Wednesday, May 24, 2006 10:27 PMdhopton MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    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.