Is it possible to create a Visual Studio project with an output type of "none"?

I am using Visual Studio 2008 and would like to create a kind of container project that contains several DLLs that must be installed with the solution. I want them to be in a separate project so that they can be easily tied to a solution in the form of a group.

I created an empty TEST project, added my DLL to it using the "Content" action, and set them to Always Copy. Everything works the way I want. The problem is that if I set the output type of the TEST project to “Console Application” or “Windows Application”, which it will not build, because there is no entry point. If I set the output type to the "class library", it builds, but I get an additional TEST.DLL file, which I really do not need.

Is there a way to sort the Output type to "none"? I want assembly actions to be performed (so my DLL is copied), but I don't want a dummy class assembly to be created. Any ideas?

Thanks!

+6
visual-studio projects-and-solutions
source share
3 answers

Assumptions for the following walkthrough:

Suppose you have a solution with two projects:

  • Main : your main (start-up) project.
  • BundledDLLs : a library project containing a .dll , which should go to the main output directory of the project.

Walkthrough:

The easiest way to achieve your goal inside Visual Studio is probably the following:

  • Add all the BundledDLLs to BundledDLLs and set them to Copy to the output directory to copy if it is newer.

    This is done in Project Explorer and in the property windows.

  • Configure the BundledDLLs output BundledDLLs , which will be identical to the Main output directory.

    This can be done on the Build tab on the BundledDLL Project Properties page. In the Output Path text box, enter something like the following:

     ..\Main\bin\Debug 
  • Configure BundledDLLs as a dependency on Main .

    Do not add BundledDLLs as a reference to the Main project, as usual. use the Project Dependencies dialog instead. This will tell the build tool that whenever Main is built, BundledDLLs must first be created.

    Do this by right-clicking on the Main node project to open the context menu; select "Project Dependencies" ... from there. In the dialog that opens, first select Main from the drop-down list; then check out BundledDLLs in the project list below. BundledDLLs now registered as a dependency on Main .

    PS: One of the drawbacks of the lack of an explicit assembly reference in Main is that some tools may not recognize the dependency. For example, ClickOnce deployment may not work correctly.

  • Add a post-build event to BundledDLLs that removes the extra BundledDLLs.dll .

    As you said, you do not want and do not need the dummy output generated when building BundledDLLs . So add a post-build event that will simply remove this .dll after it is created.

    Open the Build Events tab on the BundledDLLs Project Properties page and enter the following into the post-build text box:

     DEL "$(TargetDir)\$(TargetName).*" 

    (If you were wondering: the reason you did not add this project as a reference to the Main project before, because if you did this, Main will look for BundledDLLs.dll , which it won't be able to find, since you you don’t really want this file to be created.)

    PS: One of the drawbacks of adding this step after assembly is that it can interfere with incremental builds. If after that your project is recompiled from scratch, you might be better off removing the step after the build and living with the extra BundledDLLs.dll in your solution output directory.

+5
source share

Another option is to use a makefile project that does not require you to build / link anyway.

In the project properties (right-click property in the solution explorer and click "Properties") in the "Configuration Properties" section, and then in the "General" section, select "Makefile" from the "Configuration Type" drop-down menu. The output of the assembly will include the warning "NMakeBuildCommandLine Property" does not exist ... Skip, but the assembly will succeed without creating any dll / exe / etc.

While the other answers here may better reflect your specific need, the make-file task more directly answers the title of the question "Is it possible to create a Visual Studio project with no output type?" Hope this is useful for people who do something with this and land here.

The loan goes to Xeek on the #winapi freenode irc channel to share this advice.

+2
source share

Instead of putting them in a project, you can put files in the solutions folder . One of your projects may have an assembly action that performs copying, but since they will not be in the project, they will not try to “build”.

+1
source share

All Articles