Can I compile DLLs without Visual Studio?

2019-06-23 00:18发布

My intention is to take a C++ library, wrap it for C# with SWIG (alt. link), and compile both C++ and C# components as DLLs for Unity 5. (The C# DLL provides Unity with an interface to the C++ DLL.)

To the best of my knowledge, compiling C++ and C# DLLs always requires Visual Studio (or tools like msbuild that come with VS). However, I am currently struggling to get VS installed, which has led me to question that assumption.

Are there any other options for compiling Unity-ready DLLs on Windows?

(Even if I get VS installed, I'm still curious to know.)

4条回答
Fickle 薄情
2楼-- · 2019-06-23 00:27

Use command line tools like csc (C# Compler), they have everything to do the job, you do not need anything else, check this out the Link.

You just need to install .Net framework to get the compiler no VS or any other tool required. It has switch for every option provided by VS.

In case you need assembly linking use the Assembly Linker tool Link.

Check the following Link on ILMerge too

查看更多
趁早两清
3楼-- · 2019-06-23 00:31

You can download a stand alone version of MSBuild and use that to compile you code, you don't need VS for that.

There's a walkthrough here:

msbuild buildapp.csproj /t:HelloWorld
查看更多
混吃等死
4楼-- · 2019-06-23 00:31

You can also compile your project with MonoDevelop. You just have to choose the Release Mode instead of the Debug one.

查看更多
Animai°情兽
5楼-- · 2019-06-23 00:33

Yes, you can use MinGW to compile C++ to a DLL from the commandline.

If you prefer a GUI interface, you might try Code::Blocks. It comes bundled with a tweaked version of MinGW, but since it's a GUI-based IDE you don't have to interact with it directly :)

However, you'll still need to get your swig-wrapped code into a C# DLL. I'd investigate whether MonoDevelop can achieve this.

EDIT: Just seen ReCoF's answer - it seems you can use MonoDevelop for the C# side of things so you're good to go :)

查看更多
登录 后发表回答