none
Pre-build event command line is blocked by group policy

    Question

  • Hi,

    I'm trying to run some command line in Pre-build event, but I got an error.

    Please see bellow photo:

    Could you please give me some suggestion how to fix it? Thanks.

    BTW, I'm using VS2015 enterprise edition, if I run vs as admin no error.

    Best regards,

    Jerry


    .Net Windows C#


    Monday, December 25, 2017 3:33 AM

Answers

  • @Jerry, I also don't know which group policy cause this issue. If connected to a domain, the restriction may be coming from the server in which case you need to talk to the server administrator to figure out why it is there and if it can be removed.

    If it is a home network or a stand-alone computer, then you access Group Policy Editor by going to Start / Search Box and type in Group Policy Editor and then double-click on the program icon that apppears. But you are in the Editor now.  Here's the problem - there's no way to search the editor so you need to essentially check every group policy to find the one that's blocking you. But if it says Group Policy is the cause this program is where the solution lies. I wish there was an easier way, change your project from user folder to other folder, for example, D:\WorkSpace. 


    Sometimes security software blocks programs using Group Policy so it's possible that's how this happened, you can try to suspend the security software for test.

    Hope this helps.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 25, 2017 8:14 AM

All replies

  • Hi Jerry F H Wu,

    >>>Could you please give me some suggestion how to fix it?

    That because the user folder is a folder who has access. When we run VS without administrator privileges, VS is treated as a normal user when it accesses the folder. So if we delete file in that folder, VS will be denied by windows:

    To resolve this issue, you can run your Visual Studio as Admin (You have already done this).

    If run VS as admin is not the option for you, you can also change the permission for common account:

    Right click the User folder->Select Properties->switch to security tab->Everyone->Edit->Full control->Apply:

    Hope this helps.


    MSDN Community Support Please remember to click Mark as Answer. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Monday, December 25, 2017 7:09 AM
  • Hi Leo,

    Thanks for you reply. I already have the full control permission of the project folder.

    The error I got is not the same as you got.

    The detail error is :

    1>------ Build started: Project: Prism.PubSubEvents, Configuration: Debug Any CPU ------
    1>  This program is blocked by group policy. For more information, contact your system administrator.
    1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1250,5): error MSB3073: The command "cd C:\Users\Public\GitWorkspace\SMP-Windows\SMP_Windows\Prism.PubSubEvents\
    1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1250,5): error MSB3073: del project.json
    1>C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1250,5): error MSB3073: del project.lock.json" exited with code 1.

    I think I need to change some local group policy to make it work, but I don't know change which one.

    I also want to explain Why I need to delete project.json.

    I have two project, one is windows8.1 and another is universal windows project, there are share some classes. windows8.1 project will build failed if the project folder contains project.json file, so I need to delete it before build it.

    Best regard,

    Jerry


    .Net Windows C#


    Monday, December 25, 2017 7:45 AM
  • @Jerry, I also don't know which group policy cause this issue. If connected to a domain, the restriction may be coming from the server in which case you need to talk to the server administrator to figure out why it is there and if it can be removed.

    If it is a home network or a stand-alone computer, then you access Group Policy Editor by going to Start / Search Box and type in Group Policy Editor and then double-click on the program icon that apppears. But you are in the Editor now.  Here's the problem - there's no way to search the editor so you need to essentially check every group policy to find the one that's blocking you. But if it says Group Policy is the cause this program is where the solution lies. I wish there was an easier way, change your project from user folder to other folder, for example, D:\WorkSpace. 


    Sometimes security software blocks programs using Group Policy so it's possible that's how this happened, you can try to suspend the security software for test.

    Hope this helps.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 25, 2017 8:14 AM
  • Hi Leo,

    My device in a domain. If the restriction come from the sever, it means no easy way to fix it.

    Anyway thanks for you reply.

    Have a good day.

    Jerry


    .Net Windows C#

    Monday, December 25, 2017 8:41 AM
  • @Jerry, if you are in the domain and this restriction come from the sever, it`s not easy to fix this error on client. If above answer help you to resolve this issue, you could mark it as the answer, so it could help other community members who get the same issues.

    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, December 25, 2017 8:59 AM