Disable “You should only open projects from a trus

2020-08-09 08:22发布

I am opening the project from a network share and it keeps prompting me for this. Anyone know how to stop the warning?

This is in Visual Studio 2015 blend.

https://social.msdn.microsoft.com/Forums/vstudio/en-US/7cf8f449-6f6c-42d4-bc41-ddf55142d8f1/how-to-disable-security-warning-you-should-only-open-projects-from-a-trustworthy-source?forum=vseditor

2条回答
The star\"
2楼-- · 2020-08-09 08:34

Rather than completely disabling the warning, you can remove the information that Windows uses to identify that the solution/project came from an untrustworthy source (but only for projects e.g. downloaded from the internet -- if you're opening them from a network location it considers non-trustworthy, such as a share that's not on Local Intranet, this doesn't apply). It stores this in an "Alternate Data Stream" (ADS) which you can view by running the following from the command prompt:

C:\devs\MyProject>dir /r
 Directory of C:\devs\MyProject

09/29/2016  03:43 PM    <DIR>          .
09/29/2016  03:43 PM    <DIR>          ..
09/29/2016  03:42 PM    <DIR>          API
09/29/2016  03:42 PM    <DIR>          bin
10/17/2016  10:32 AM             3,078 Project1.csproj
                                    26 Project1.csproj:Zone.Identifier:$DATA

The Zone.Identifier:$DATA ADS file is what's causing VS to identify it as untrusted. You can remove the data just for that project by right-clicking the csproj file, clicking Properties, and choosing "Unblock" on the General tab.

Unblock in Explorer

Or, to remove the ADS recursively for all files in a directory, download the streams tool from SysInternals, cd to the directory and type:

streams -s -d .

Note that you can actually view the ADS file, which is just a regular text file, by typing e.g.

notepad Project1.csproj:Zone.Identifier:$DATA

In this case, it will have contents such as:

[ZoneTransfer]
ZoneId=3
查看更多
小情绪 Triste *
3楼-- · 2020-08-09 08:39

Just uncheck the following option:

  • Tools > Options > Projects and Solutions > Warn user when project location is not trusted
查看更多
登录 后发表回答