I have a ClassLib1 project that is referenced by many other projects. I want to know if there is a way to include a build targets file for those referencing projects via the ClassLib1? Similar to the way a nugget package can.
Related
I have been working maven projects since 2 two years.First of all, I import maven projects to eclipse then
thanks to my pom.xml some dependencies is installed and I see these dependencies on my maven dependencies folder on eclipe project explorer.It connected to my .M2 folder.
Right now , I import a .Net framework project (which is written with C#) in my visual studio program.The solution explorer (references section) show many dependencies(they gives error).Then I found these libraries then I created a folder which is called nugetPackages and I connected my nuget packages manager to that folder(tools/options/nuget package manager/package sources).I reopen my project and libraries on references section does not give any error.My question is where does that libraries names come from ? There are any file like that pom.xml.
I hope I can explain my situation.
Are the libraries (DLLs) that you want to reference in your project NuGet packages or just some framework libraries? If they are Nuget packages they should be described in packages.config file http://prntscr.com/1140xn0 for the classic .NET application (.net framework 4.5 for example) In a .Net Core applications the Nuget packages that are required are defined in the file .csproj file http://prntscr.com/11412iq. In both cases, you can download all required NuGet packages by right clicking on the .sln file and selecting Restore Nuget Packages http://prntscr.com/1140zsk This will automatically create the nugget folder and download all required Nuget packages. If you have manually added dlls you need to navigate to them and select them by right-clicking References - Add reference http://prntscr.com/114142x
Using .NET Core 2.2, I want to create a NuGet package with native dependencies for different platforms (win-x64, linux-x64, linux-arm). The dependencies are pre-built DLLs/SOs using a C compiler.
I've successfully created the NuGet package with all dependencies put into the runtimes folder in a subfolder for each platform.
My problem is that I have a unit test project in the same solution and I need the native dependencies to be copied to the output folder for the unit tests to run successfully.
The question is where in the source to put the native dependencies so that the correct one is copied to the output folder when I build or publish for a specific platform. Also, what do I need to add to the .csproj file to achieve this?
I'm Nuget packaging with CreateNewNugetPackageWithEachBuild.
Nuget auto installs dependencies another Nuget packages. It works.
But this is not work in Framework libraries like the System.Drawing namespace, UIAutomationTypes assemblies etc.
So when I install my Nuget package, after install that -> and goto "add reference" menu and add framework assemblies manually (System.Security or something, not yet added another DLLs when create project time).
Can I make Nuget pakcages to auto-include the .Net Framework level assemblies when install it?
Make .nuspec file in project folder (be with .csproj file) and define frameworkAssemblies in nuspec file and build it to makes nupkg contains framework level assemblies and auto include when install it
in my c# class lib i have referenced different Projects which have references to the same dll with different versions.
Both references the nlog.dll but one project version 2.1 and the other 4.2.
The referenced project are class libs, too. Most of them are .net 2.0 and some 4.5.
Just make a Libraries folder if you need to and then create a version folder structure and 'add reference' to each project. If these are nuget packages then you shouldnt need to do this.
You need to install in the the GAC because you application has only one bin folder.
You can also try installing only NLog 4 with a <assemblyBinding> but no guarantees as NLog 2 and NLog 4 aren't fully compatible. (hence the major version change)
Im trying to create a nuget using the "Nuget Package Explorer". The project references 2 dlls witch target .net4.0 and the main dll targets .net4.5.
As specified, i put the 2 referenced dlls in a folder inside the "lib" folder called "net40", the main dll in a folder called "net45", then i pushed the nuget wich is located here
But when i try to install it in another project, it doesnt take any of the dlls !
Am I doing something wrong ?
Thank you.
UPDATE:
The nuget package contains:
lib (folder)
net45 (folder)
MainAssembly.dll -> targets .net_4.5
Microsoft.VisualStudio.TextTemplating.10.0 -> targets .net_4
Microsoft.VisualStudio.TextTemplating.Interfaces.10.0 -> targets .net_4
notes:
MainAssembly needs the two other assemblies
I just want to target the .net version 4.5
the problem :
creating a nuget package using the structure above doesnt work, when intalling the nuget in a new project the MainAssembly is not added the list of references, only the two other assemblies are added.
The project references 2 dlls witch target .net4.0 and the main dll targets .net4.5.
As specified, i put the 2 referenced dlls in a folder inside the "lib" folder called "net40", the main dll in a folder called "net45", then i pushed the nuget wich is located here
A NuGet package can target multiple .NET framework versions. However, a .NET project cannot.
Your dependent assemblies must be placed in the same .NET framework version folder in order for them to install into the target project. So, if you want your NuGet package to target 4.0 and 4.5, the structure should look like:
lib
net40
MainAssembly.dll
DependentAssembly1.dll
DependentAssembly2.dll
net45
MainAssembly.dll
DependentAssembly1.dll
DependentAssembly2.dll
The main assembly in each group must target the same framework version as the parent folder. The dependent assemblies can target any version the same or lower than the target version.
Note that typically each assembly is packaged as a separate NuGet package and the NuGet packages depend on each other, rather than putting the dependent assembiles into the same package.