No announcement yet.

The type 'Object' is defined in an assembly that is not referenced ...

  • Filter
  • Time
  • Show
Clear All
new posts

    The type 'Object' is defined in an assembly that is not referenced ...

    I am a newbie at .NET development - I'm switching from Java after couple of years. We're starting a project that will need multiple third party libraries, and Bridge seems as a great representation of converter that we need. Although I run into a problem and can't find solution even after long hours of searching. Considering my lack of experience in given technology, I'd be very pleased if you could help me out:

    I created a sample project in Visual Studio and added third party dependency injection framework to it via NuGet, called Simple Injector. Then I added Bridge, also using NuGet. After that, it's not possible for me to use even basic functionality of Simple Injector without getting this error:

    CS0012 The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=, ...
    I found out that Bridge actually removes System namespace references and uses its own implementation of many classes.
    I assume that given third party library references original System namespace and therefore problem occurs after removing references.

    I guess there has to be this problem with many third party libraries, but I couldn't find any solution that would work for me. Is there any way to set references up correctly?

    I'm also including my .csproj file:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="15.0" xmlns="">
      <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
      <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
        <Reference Include="Bridge, Version=, Culture=neutral, processorArchitecture=MSIL">
        <Reference Include="SimpleInjector, Version=, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL">
        <Compile Include="Class1.cs" />
        <Compile Include="Properties\AssemblyInfo.cs" />
        <None Include="bridge.json" />
        <None Include="packages.config" />
      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
      <Import Project="..\packages\Bridge.Min.17.7.0\build\Bridge.Min.targets" Condition="Exists('..\packages\Bridge.Min.17.7.0\build\Bridge.Min.targets')" />
      <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
          <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see The missing file is {0}.</ErrorText>
        <Error Condition="!Exists('..\packages\Bridge.Min.17.7.0\build\Bridge.Min.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Bridge.Min.17.7.0\build\Bridge.Min.targets'))" />
    Thanks a lot,

    Hi Patrik,

    Welcome to Bridge! Thanks for the excellent question.

    At this time, Bridge cannot reference non-Bridge Assemblies. All Assemblies in the project must be Bridge enabled projects, so directly referencing the SimpleInjector project is not going to work. SimpleInjector would need to be compiled with Bridge first, then that Assembly referenced in your project.

    Hope this helps clarify things.


      Thanks for explanation.

      So let's say that I will do the following:
      1. add SimpleInjector sources as separate project to my solution
      2. add Bridge to it like I did to my project
      3. referenced this SimpleInjector project with Bridge in my project, instead of assembly downloaded via NuGet
      would it theoretically work?

      If yes, there are two more questions that come to my mind:
      1. What about build (conversion) process? Would it work out-of-box this way or there would be some advanced configuration needed?
      2. I guess that SimpleInjector (or any other thrid party framework) contains lot of code, so there's a big chance that some of it will not be supported for conversion by Bridge. Am I right? Is there any list of supported/unsupported parts of .NET framework?
      If my DIY solution wouldn't work, do you know about any asseblies that are, like you said, "Bridge enabled" ? It would be nice to have list of such ones.


        would it theoretically work?
        Yes, theoretically it would work, but I suspect it will not in this case because SimpleInjector itself likely references other 3rd party Assemblies that themselves would also need to be Bridge enabled projects.

        There's another problem. With the current release, Bridge does not support compiling of .NET Core projects, only .NET Framework.

        It's a tough situation and we wish we had the resources (time + money) to build .NET Core support into Bridge, but currently, it's not possible.


          Thank you for your effort.

          By the way, I ran into this project recently:
          Do you know it? It seems that it offers many 3rd party libraries and is Bridge enabled. I'll have a look if I can find alternative dependency injection framework there.
          If not, at least it can be useful for someone reading this.


            Hello Patrik!

            Retyped is a project from this same company, see at the bottom of the page "A project of Object.NET". Our Deck code fiddler has extensive support for it (not that all libraries are included in Deck).

            hope this helps!