Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven equivalent in .NET C#

Let's assume there are two Maven Java projects, A and B. A has a dependency on B. B is placed in remote Maven repository and also on GitHub.

In IntelliJ Idea IDE, I will open project A and also B (B is cloned from GitHub) in two separate windows.

Now, B has a class named Car. When I 'Ctrl+Left mouse button click' on class Car in project A, IDE switches me automatically to the source code in opened project B. Therefore I can comfortably work together on A and B.

How can I achieve same behaviour with .NET C# and Visual Studio?

like image 675
Jurass Avatar asked Feb 03 '18 11:02

Jurass


People also ask

Is Maven used in C#?

Maven is written in Java and is used to build projects written in C#, Scala, Ruby, etc.

Can Maven be used for .NET projects?

NPanday is an Apache Incubator project "to integrate Apache Maven into . NET development environments." Maven is more of a build-automation and dependency-management tool, and also developed more specifically for Java-based development, but developers have figured out how to Maven build for . NET applications.

Is Maven same as NuGet?

Maven manages dependencies and the build process for Java projects. Homebrew simplifies package installation for Mac and Linux operating systems. Npm installs and tracks JavaScript dependencies. NuGet manages dependencies for .

What is gradle vs Maven?

Gradle is based on a graph of task dependencies – in which tasks are the things that do the work – while Maven is based on a fixed and linear model of phases. With Maven, goals are attached to project phases, and goals serve a similar function to Gradle's tasks, being the “things that do the work.”


1 Answers

The rough equivalent to Maven in the .NET ecosystem is NuGet. NuGet files can be created using the IDE or command-line tools such as dotnet pack or nuget pack. A NuGet file is just a regular .zip file with the .nupkg extension. These files can be hosted on http://www.nuget.org for the general public to consume, on a site such as http://www.myget.org, or on a private hosted NuGet server.

The NuGet tools also have the ability to create debug symbol packages that contain the source code files. The debug symbol packages can be hosted on public or private symbol servers and used in Visual Studio to step through the code, with the configuration options enabled in Visual Studio.

If you open project A in Visual Studio and automatic package restore is enabled and that project has a package reference to project B, when you build the project it will automatically download the NuGet file for project B, unpack it to your local NuGet cache, and use the assembly for project B in your project.

If Visual Studio is configured correctly to find a debug symbols package corresponding to the exact version of project B, it will allow the debugger to step through the code of project B.

AFAIK, opening the code file of project B and then setting a break point is not possible (someone leave a comment if this is wrong), you need to set a breakpoint in project A and then when you step into the line that calls/instantiates the Car class, Visual Studio will open up the code file so you can step through it.

like image 150
NightOwl888 Avatar answered Sep 21 '22 12:09

NightOwl888