Could not load file or assembly 'Microsoft.CSharp' when logged in with user which is not a member of administrator group
c#, compiler-errors, permissions
Solution
This one solved my problem.
- Right click on Visual studio (whichever version you use)
- Properties
- Select compatibility tab
- Fill the checkbox which says "Run this program as administrator"
- Open the project from the file location
- Run the application
Problem
I have created a website which compiles successfully when I log-in using administrator but when I log-in using any other user, following error occurs. Could not load file or assembly 'Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542) The administrator user is member of - Acronis Remote Users - Administrators - Remote Desktop Users while the other user is member of - Acronis Remote users - Administrators * - IIS_IUSRS - Remote Desktop Users - SQLServerMSSQLUser$vm-tmp-abcd-1$MSSQLSERER - Users I am using Windows Server 2008 R2 Enterprise with 64-bit Operating System - Initially the other user didn't belong to administrators group. I added the administrators role to it but still I am getting the same error. NOTE: It compiles the website successfully if I choose VS2010 to run as administrator.