Bundling assemblies (DLLs) into one assembly for other's to reference - c#

Environment: Visual Studio 2013, C#, ASP.NET MVC
Question: For the projects that I create in Visual Studio that use C#, I would like to give others one compiled DLL as opposed to them having to add any extra DLL references themselves.
Example:
I have a project that is used for web services:
MyProjectWebServices.dll <-- this is what I would just like to hand out
Some3rdParty.dll
Another.dll
SomethingElse.dll
So, for the above 4 libraries that other projects need to reference as well since my original distributable library (MyProjectWebServices.dll) references them, is there a way to bundle the bottom 3 into just the first one?

Related

What Method of Shared Code Files Does Visual Studio/ReSharper Perform Better With?

Setup
VS Enterprise 15.7.6
ReSharper Ultimate 2018.1.3
I have to deploy .net Class Libraries without any expediencies on other dlls outside of the .net Framework and I'm trying to figure out Visual Studio / ReSharper performance implications (the performance of the IDE itself, not the compiled/deployed code) for sharing code files.
My solution has 23 .net 4.5.2 class library projects, and 1 shared project. This shared project is unique to this client. I also have shared code that is not unique to the client that is shared as a source only nuget package. This means the same code is added to every project and checked into TFS under every project.
Question
Would Visual Studio / ReSharper have better performance if I removed all the source only NuGet files, and added all of these files to the Shared Project?
Currently VS spends a lot of CPUs each time I type a keystroke, and I'm wondering if this change would help. Only Negative is that any upgrade of the Source Only Nuget Package would be manual...
Update 1 Added PrefView

Wrap around legacy .NET Project in .Net 4.5 project

I have a legacy project (written and compiled in .Net 2.0), it is huge, and lots of other projects are referencing that. It is planned to decommission it, but it will take some time. I'd like to introduce new version of that project where any new functionalities will be put and .NET 4.5.1 will be introduced.
I want to keep all the old functionality of old project to be accessible from the new Project2 and only. Without converting old project from .Net 2.0, without any need to reference Project1 dll when Project2 is already referenced.
I am aware that projects compiled for .NET lower than 4.5.1 won't be able to reference Project2 (because of higher .net incompatibility), Project2 is a part of new world created to abandon the legacy code.
How can I achieve that? Currently I am inheriting all public classes (~150 of them), it works but still I need to reference dll of the old project.
You could create an intermediary assembly which references your old assembly and it's newer replacement. Then from any future projects, it could just reference the intermediary assembly. That would allow you to work at your own pace to slowly replace functionality in the old assembly with functionality in the new assembly while not affecting higher-level code that references it.
How about this:
Create a new solution
Add a project to this solution and set its .Net version to 2 (project 1)
Add another project to this solution and set its .Net version to 4.5 (project 2)
Yo can add the classes (source code files) from project 1 into project 2 by adding 'Existing Items' and making sure that you add them as link (click on the down arrow on the 'Add'button in the open file dialog). Or you could just copy the code files into project 2 (duplicating the code)
Each project will have a different DLL name and can be in different version

Multiple Language Projects in Visual Studio

I've recently learned of the joys of compiling projects into dlls to use them in other projects! However, now I'm trying to streamline a process where I have two projects, one written in C# and the other in VB, where the C# project has dependencies on a dll compiled from the VB process.
What I'm hoping I can achieve:
- Have both of these projects viewable within the same VS project
Pull updates on the VB code from SVN and compile them into a dll located
in a folder within the project
Not have to update my references in the C# project as I am updating the same dll in the project.
Build the C# project whenever needed, without rebuilding the VB project
Can this be done?
Thanks!
Is this a VB.NET project? If so, you're in luck.
1) You cannot have a Visual Studio project that uses multiple languages (unless you count ASM in C/C++). However, a single Visual Studio solution can have multiple projects where each project uses a different language.
2) If the projects are C# and VB.NET (or F# or Managed C++ or any other language that produces a .NET assembly), there is little difference in the output assemblies of one versus the other. A C# project can reference an assembly built with VB.NET and vice-versa.
3) If the projects are in the same Visual Studio solution, you can use Project References instead of Assembly References. Project References make it so that one project depends on the output of another project in the same solution. You establish the project reference once (in VS2015: Right-click Project => Add => Reference... => Projects => select the project to reference). And then Visual Studio/msbuild automatically knows the correct order to build them (and whether or not to build them at all). It's even smart enough that if you change the output location of the referenced project, you don't need to do anything to the referencing project.

How to use wixlibs as file references with support for different platforms?

I just am trying to replicate my distributed C# project structure to WIX setup projects. Now there is the following problem:
LIB: a C# library solution that builds AnyCPU .NET dlls from several C# projects
APP: the dlls from LIB are referenced (as file references) by this main application solution. Additionally there are platform dependent libs included in this application solution, therefore it is important to being able to create setups for the two specific target platforms x86 and x64.
Now I started to create a wixsetup project within the APP solution (which works fine). Then I proceeded with creating a wixlib within the LIB solution that references the LIB .NET dlls into the wixlib.
Now the problem:
The wixlib references the AnyCPU .NET dlls within a DirectoryRef which seems to be platform specificly tagged when creating the wixlib. Therefore I have to go back to the LIB solution, build the project with one platform target, copy the built files (via SVN externals mechanisms) to the APP solution, build this project with the exact same target platform as the wixlib was created with and repeat this procedure for creating the other platform.
It may seem that this is kind of complicated, but doable. Due to the fact that I omitted several other library solutions for which the same problem applies and the fact that all those libraries are used in multiple application solutions and - finally - everything has to run on our build server automatically as well, it is clear that this will not work.
I know of the following solution, though:
Double the .NET dll references within wixlib to assign them to different DirectoryRef INSTALLDIR and INSTALLDIR32 e. g. and to implement those different directory references in the wixsetup.
But this would complicate things as well and is not my preferred solution therefore - if there is an alternative.
If there is no smart alternative, just tell me and I will do things as described in the last paragraph.

How to reference a C# Class Library project in Visual Studio 2010?

I am new to visual studio and was wondering how to setup visual studio 2010 so that I can reference my C# windows class library project? I currently have a solution with 2 projects - C# library project and a unit test project.
What is the best way to create multiple clients that will use this library? Should they be their own solution or just another project in the library solution? How do I use the classes in the library function from the project that references the library project?
You can add a reference to a library by doing a rightclick on the references node in the solution explorer and selecting the req. lib...
When all you consuming apps are located within the same solution I would prefer to place the lib also inside the sln, otherwise I would use an extra sln
Right click on the Client project "References" - > Add Reference
Go to the Projects tab if the class library is in the same solution. Else Browse and select the dll of the class library.
If Class library is not going to release as common dll for multiple projects, it's better to add them all to the same solution.

Categories