MSTest run fails because source assembly is not trusted

前端 未结 10 1482
谎友^
谎友^ 2020-12-23 11:18

I just added xUnit to our test project (for the Asserts, we\'re still using MSTest as the framework) and immediately the test runs refused to execute any of the tests. This

10条回答
  •  不知归路
    2020-12-23 11:52

    Running on an XP machine (even with .NET 3.5 SP1 installed) I was not able to get any of the other solutions listed here to work.

    However working from the same post by Charles Sterling that Davy Landman references, I finally succeeded with this variation:

    1. Run the .NET 2.0 Configuration tool (Settings... Control Panel... Administrative Tools... .NET Framework 2.0 Configuration)
    2. Click down to "My Computer ... Runtime Security Policy ... Machine ... Code Groups ... All_Code"
    3. Create a new code group with membership condition of "Zone"="Local Intranet" and assign the permission set "FullTrust"
    4. Restart Visual Studio

    After these steps I am able to run tests, including after restarts and rebuilds.

    EDIT: as described in this answer, you may need to install the .NET SDK (which is different from the .NET framework) in order to have the .NET 2.0 Configuration tool on your system.

提交回复
热议问题