Matthijs
Matthijs

Reputation: 2516

Cannot resolve Assembly or Windows Metadata file 'System.Configuration.dll'

I am trying to compile a small test build (written in C#) in Visual Studio. However, I get two errors when trying so and can't find the issue. No line's are given:

Error 1: small_project.csproj

Cannot resolve Assembly or Windows Metadata file 'System.Configuration.dll'

Error 2:

Type universe cannot resolve assembly: System.Configuration, Version 2.0.0.0, Culture=neutral, PublicKeyToken.. etc..

I am new at developing with C# and XAML. Does someone know what could cause these errors?

Upvotes: 14

Views: 14912

Answers (3)

7gegenTheben
7gegenTheben

Reputation: 81

In my case the problem was that my UWP project referenced a project that referenced System.Web.Application.dll. I did:

  • Delete reference from the parent project
  • Clean and build parent project
  • Update Service Reference in child project
  • Clean and build child project
  • Remove unused reference from child project (System.Web.dll)

I learnt it's better to use nuget packages instead of adding references manually.

System.Web.ApplicationServices-Error

Upvotes: 0

kayleeFrye_onDeck
kayleeFrye_onDeck

Reputation: 6978

I had this issue when my project's nuget packages weren't available when trying a remote build on Jenkins.

I just added a build-step to locate NuGet and then call restore on the project/solution to resolve this for automation purposes.

This is just a segment of a script that I'm copying, so update to your needs:

where nuget > nul 2>&1 nul
IF "%errorlevel%"=="0" where nuget > .\where_nuget.txt && Set where_nuget=where_nuget.txt
IF NOT "%where_nuget%"=="" FOR /F "tokens=*" %%I IN ('type where_nuget.txt') DO call "%%I" restore "%Build_Target%"

Upvotes: 0

Robert Snyder
Robert Snyder

Reputation: 2409

I know that this question is old and all, but I am faced with the same error. I've done numerous xaml apps using a variety of test frameworks. I think that you might have made a Universal Windows App using the Unit Test template. Something in the MStest framework that was added was giving me the same exception that you reported here. After lots of looking around I watched a channel 9 video that mentioned them using xUnit for their UWP testing. I went to this site xUnit on github and did what they mentioned which was:

  • remove references to ms test
  • open projects.json
    • add xunit 2.1 and xunit.runners.visualstudio 2.1 dependencies
    • fix my unit test to use xUnit instead of MsTest/Nunit
  • build
  • opened test explorer and ran all tests

I'll have to keep in mind that testing UWP is going to be different than normal apps and so to change my expectations. Hopefully this helps others as well as the OP.

Upvotes: 0

Related Questions