Unblocking a DLL on a company machine. How?

2019-01-11 13:55发布

问题:

I am trying to test out MVVMLight but the DLLs that come with it are BLOCKED. I have read about it and I am told to click the UNBLOCK in the file property.. but that doesnt exist for me.. Then I found out of a program called STREAMS that is suppose to unblock.. that didnt work... any other idea how to fix this?

Error 7

Could not load the assembly file:///C:\MIX10-MVVM-Samples\Mix10.MvvmDemo2 - End\Mix10.MvvmDemo2\Bin\Debug\GalaSoft.MvvmLight.Extras.SL4.dll

. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust. See http://go.microsoft.com/fwlink/?LinkId=179545 for more information. Mix10.MvvmDemo2

回答1:

The file contains an alternate data stream that indicates that the content was retrieved from the Internet and is not secure. This is a feature of the NTFS file system, one that's unfortunately well hidden because Explorer has no support for showing their content. You can see them from the command prompt with the DIR /R command option. And type their content with TYPE filename:streamname. And delete them with DELETE filename:streamname

Other tricks is to copy the file to a file system that doesn't support alternate data streams, that slices them off the file. A flash drive for example. Or a zip utility.

Later versions of Windows, I think starting with Win7, has built-in support for this in Explorer. Right-click the file, Properties and click "Unblock".



回答2:

SysInternals has a great command line utility called Streams. This proved very useful for me.

Streams v1.56 - Enumerate alternate NTFS data streams Copyright (C) 1999-2007 Mark Russinovich Sysinternals - www.sysinternals.com

usage: streams [-s] [-d] <file or directory>
-s Recurse subdirectories
-d Delete streams

Execute the following command in the directory you wish to remove streams from (same effect as copying to USB/FAT32 drive)

streams.exe -d -s *.*



回答3:

Unblock the zip file first, and then extract the dll's. Actually that's what they instruct to do here.



回答4:

Only for general understanding. NTFS supports streams (see http://msdn.microsoft.com/en-us/library/aa364404%28VS.85%29.aspx). The full name of a stream is filename:stream_name:stream_type. So one can easy write some additional information about a file in an additional stream of file. If you download a file from the internet Internet Explorer write some simple information in a stream with the name Zone.Identifier. If you have a file test.dll downloaded from the internet you can use

more < test.dll:Zone.Identifier

to see information from the stream. You will see something like

[ZoneTransfer]
ZoneId=3

Unblocking is not much more as deleting of this stream. I recommend you to read http://weblogs.asp.net/dixin/archive/2009/03/14/understanding-the-internet-file-blocking-and-unblocking.aspx for more detaild information



回答5:

I simply opened the dll file in notepad++ and saved it with a different name.



回答6:

If it helps anyone, I pulled down two blocked DLLs from TFS.

My solution:

  • Inside of Windows Explorer, delete the two blocked DLLs.
  • Inside of TFS, do a 'Get Specific Version' operation on the folder, and make sure that 'Overwrite all files even if the local version matches the specified version' is checked so that you will pull down fresh copies of the deleted DLLs.
  • Rebuild your solution.