Disable “You should only open projects from a trustworthy source” message in VS 2015

会有一股神秘感。 提交于 2020-03-18 10:36:56

问题


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


回答1:


Just uncheck the following option:

  • Tools > Options > Projects and Solutions > Warn user when project location is not trusted



回答2:


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.

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


来源:https://stackoverflow.com/questions/31187339/disable-you-should-only-open-projects-from-a-trustworthy-source-message-in-vs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!