Visual studio one project with several dlls as output?

后端 未结 5 606
面向向阳花
面向向阳花 2020-11-27 14:42

I\'m programming a project with plugin support. Since many of the plugins are relatively small (only one source-file/class) I would like to have them all in one project in

5条回答
  •  春和景丽
    2020-11-27 15:03

    To expand upon Julien Hoarau's answer above, here is a solution that allows you to compile multiple DLL files from within a single project, and have those DLL files be compiled from multiple CS files. Just open your csproj file and add this before the tag:

      
      
      
        false
        false
        false
        false
        false       
      
      
      
      
      
      
      
        false
        false
        false
      
      
      
        
        
        
        
      
    
      
      
      
    

    This is my approach - it lets you keep everything organized at the bottom instead of spread out throughout the project file. Using

    false
    

    allows us to hide the files from the SolutionExplorer, and have a separate defined list of files instead of simply adding the plugin tag to the files we want. In your main solution, be sure to set the Build Action to "none" on all the files you are compiling in the plugin so there is no duplication in the main project file.

    Some more reading about CSC:

    https://msdn.microsoft.com/en-us/library/78f4aasd.aspx Command-line Building With csc.exe

    https://msdn.microsoft.com/en-us/library/ms379563(v=vs.80).aspx Working with the C# 2.0 Command Line Compiler

    https://msdn.microsoft.com/en-us/library/s5c8athz.aspx Csc Task

    https://msdn.microsoft.com/en-us/library/7szfhaft.aspx MSBuild Conditions

    I hope this is useful to someone.

提交回复
热议问题