This is basically an aftermath question after this question I posted yesterday. Long story short, I had troubles referencing System.ServiceModel
in my Unity application and I got that fixed by having this mcs.rsp file
:
-r:System.ServiceModel.dll
And by having Scripting Runtime Version
and Api Compability Level
settings aligned to .NET 4.x
. However, now I am facing another issue.
Unity project builds fine!
So, let me first point out that my project runs fine without compile errors. So on that regard it is just fine. The problem I am facing is an annoyance that I am getting in Visual Studio and impacts my development experience.
Errors in Visual Studio
Basically when I open the C# project in Visual Studio, I get type errors like this:
Even though assembly System.ServiceModel
is now correctly loaded in the project, Visual Studio shows me errors complaining about the fact that those highlighted types are not available.
The type or namespace "ServiceHost" could not be found (are you missing a using directive or an assembly reference?)
Why? This is extremely annoying when developing, I cannot possibly carry out a whole development with fake errors showing up like this :(
A few more info...
If I inspect generated project file Assembly-CSharp.csproj
, I can see this:
<Reference Include="System.ServiceModel.Duplex">
<HintPath>C:/Program Files/Unity/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Duplex.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel.Http">
<HintPath>C:/Program Files/Unity/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Http.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel.NetTcp">
<HintPath>C:/Program Files/Unity/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.NetTcp.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel.Primitives">
<HintPath>C:/Program Files/Unity/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.ServiceModel.Security">
<HintPath>C:/Program Files/Unity/Editor/Data/MonoBleedingEdge/lib/mono/4.7.1-api/Facades/System.ServiceModel.Security.dll</HintPath>
</Reference>
So it makes me wonder:
- Seems like Unity is pointing to the mono generated dlls of the required dlls. However where is
System.ServiceModel.dll
? - I can see there is
System.ServiceModel.dll
in the folder containingFacades
, why isn't that used?