Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Assemblies References

Assemblies References

Scheduled Pinned Locked Moved C#
helptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Heinz_
    wrote on last edited by
    #1

    Hi all, ¿Is it possible to compile 2 assemblies and making reference one to each other? Example: We want to compile MySoftware.exe and MyLibrary.dll, we do it as follow: csc.exe /target:winexe /out:MySoftware.exe /reference:MyLibrary.dll csc.exe /target:library /out:MyLibrary.dll /reference:MySoftware.exe I want both assemblies to access the other assembly methods but at compile time is obviously that the other file does not exist, so compile error displays. Thanx

    L S 2 Replies Last reply
    0
    • H Heinz_

      Hi all, ¿Is it possible to compile 2 assemblies and making reference one to each other? Example: We want to compile MySoftware.exe and MyLibrary.dll, we do it as follow: csc.exe /target:winexe /out:MySoftware.exe /reference:MyLibrary.dll csc.exe /target:library /out:MyLibrary.dll /reference:MySoftware.exe I want both assemblies to access the other assembly methods but at compile time is obviously that the other file does not exist, so compile error displays. Thanx

      L Offline
      L Offline
      Lars Niedziolka
      wrote on last edited by
      #2

      A solution (but not the best) is to build a stupid MyLibrary.dll with the needed public class, but without implementation. public class MyLibraryClass { public int ComputeSomething(int l, int r) { throw new NotImplementedException(); } } Than build the exe against this stupid Library. Than build the real Library against the exe. I have not tested this solution. If you try it, please write your result. Good luck. Lars Niedziolka

      1 Reply Last reply
      0
      • H Heinz_

        Hi all, ¿Is it possible to compile 2 assemblies and making reference one to each other? Example: We want to compile MySoftware.exe and MyLibrary.dll, we do it as follow: csc.exe /target:winexe /out:MySoftware.exe /reference:MyLibrary.dll csc.exe /target:library /out:MyLibrary.dll /reference:MySoftware.exe I want both assemblies to access the other assembly methods but at compile time is obviously that the other file does not exist, so compile error displays. Thanx

        S Offline
        S Offline
        Stefan Troschuetz
        wrote on last edited by
        #3

        Heinz Suez wrote: csc.exe /target:library /out:MyLibrary.dll /reference:MySoftware.exe You should not reference an executable. MSDN says: "At run time, you should anticipate that only one .exe assembly can be loaded per process, even though, there may be times when more than one .exe might be loaded in the same process. Therefore, do not pass an assembly built with /target:exe or /target:winexe to /reference. This condition may be modified in future versions of the common language runtime." To solve your problem. Try either to move all functionality needed by MyLibrary into MyLibrary, so it can be compiled without referencing, or maybe create a second library that gets referenced by MyLibrary and MySoftware.


        www.troschuetz.de

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups