Visual Studio For Mac 2017 Tutorial

broken image


< Modding Tutorials

  1. Visual Studio For Mac Tutorial
  2. Visual Studio 2017 For Mac

This page was originally created by Alistaire.

  1. For Visual Studio for Mac, see Extensibility walkthrough in Visual Studio for Mac. Prerequisites Before you start, make sure you have installed the Visual Studio extension development workload, which includes the VSIX template you'll need and sample code.
  2. Now that you know the basics of working with Visual Studio Extensibility, here's where you can learn more: Start to develop Visual Studio extensions - Samples, tutorials. And publishing your extension; What's new in the Visual Studio 2017 SDK - New extensibility features in Visual Studio 2017.

In this tutorial you will learn how to set up a solution, along with instructions on setting the output directory and files for more convenient building right into the Assemblies folder.

  • 2Setting up a solution
    • 2.1Visual Studio Community 2017

Visual Studio for Mac bring a world-class IDE to game developers on macOS, creating games with Unity. 2017 at 11:00AM. Amazing tutorial! Last modified Aug 05, 2017 at 10:33PM. Photoshop 2017 free download mac. The Arduino IDE is a basic tool that lacks a few important features. In an effort to resolve these lapses, I decided to try the VisualMicro, a plugin for Visual Studio 2017 which allows you to develop Arduino applications in the popular IDE. Before diving into this plugin, make sure to read my tutorial on getting started with Visual Studio.

  • The manual option in this tutorial requires you to have set up a Source and Assemblies folder (the Visual Studio automatic option sets this up for you).
  • You will want to have an IDE installed: Recommended IDE's.

Setting up can be different for different IDE's. Feel free to add complete instructions for your IDE of choice.

Visual Studio Community 2017

Visual Studio For Mac Tutorial

NOTE: Visual Studio 2017 is a rather heavy application (2-3 GB for basic functionality) but has a bit more functionality. Only Install if your computer can handle it! The tutorial is similar for Visual Studio 2015.

Word for mac trial version.

Option 1 (Manual Method):

Tutorials
  1. Create a new class library project
    1. Once loaded, go to File -> New -> Project..
    2. Go to Templates -> Visual C# -> Class Library (Be sure to select the *.NET Framework* version, not *.NET Standard*)
      Installing the .NET framework
    3. Enter your name and solution name in the lower pane.
    4. Choose a location, preferably:
    5. Optional: Untick 'Create directory for solution'
  2. In your project, set target framework and various other porperties
    1. In your Solution Explorer, right click your project -> Properties
    2. Once in your properties, select Application -> Set Target Framework to .NET Framework 4.7.2 (No client profile)
    3. Optional: Change your Assembly and Namespace names to anything of your choice
    4. Go to Build -> Advanced.. and set 'Debugging information' to none
    5. Leave Advanced.., and set the Output Path to '..Assemblies' (The Assemblies folder in your mod folder)
  3. Add references to RimWorld code
    1. Expand your project. Then right click 'References' -> Add Reference..
    2. Click Browse..
    3. Navigate towards and select files:
    4. Click 'Add'
    5. Click 'OK' to close the Reference Manager.
    6. Right click on both Assembly-CSharp.dll and UnityEngine.dll and set Copy Local to False (Properties pane).

Option 2 (Automatic Method):

This option uses the Rimworld Mod Development Cookiecutter tool.
Note: despite being automatic and potentially taking away some of the tedium away, the environment it sets up is very particular and this tool is currently not recommended for newcomers.
As of Jan 2019, the cookiecutter is set up for Windows development. Linux/Mac people can still use it, but they will have a few errors to clean up.

  1. Open Visual Studio
  2. Once loaded, go to File -> New -> From Cookiecutter..
  3. Search for rimworld
  4. Double-click cookiecutter-rimworld-mod-development
  5. Change the Template Options:
    1. Create To => Your/Rimworld/Mod/Directory
    2. mod_name
    3. namespace_name (don't change if unsure)
    4. author => your steam username
    5. target_version => current RW version (can leave blank for most up-to-date)
    6. in_game_description (not required, can change later in About-Release.xml)
    7. url (can leave blank for link to your Steam Workshop profile)
  6. Click 'Create and Open Folder'

Sharpdevelop

Caution: Sharpdevelop (or #develop) does NOT CURRENTLY allow for C# 6.0+ syntax without plugins and does NOT ALLOW for C# 7.0+ syntax at all. For your average project this does not matter, however some existing projects are already built entirely upon C# 6.0+ syntax which can not be compiled anymore in Sharpdevelop. Visual Studio does not have these issues and should be your go-to for compiling large projects such as Combat Extended. Microsoft word shortcuts for mac.

  1. Create a new class library project in your IDE of choice;
    1. Go to File -> New -> Solution;
    2. Go to C# or .NET -> Library or Class Library (NOT portable);
    3. Enter a project name (solution name automatically updated);
    4. Choose a location, preferably:
    5. Optional: Untick 'Create a directory for solution'/'Create a project within the solution directory',
  2. In your project, add references to Assembly-CSharp.dll and UnityEngine.dll:
    1. In your IDE project file browser, right-click the 'References' folder and 'Add reference';
    2. Choose the '.NET Assembly Browser' tab and 'Browse..';
    3. Navigate towards and select files:
    4. Click 'Open' then 'OK';
    5. In the References folder, right-click Assembly-CSharp -> Properties and change 'Local copy' to False. Do the same for UnityEngine,
  3. In your project properties, change the target framework to .NET 4.7.2:
    1. In your IDE project file browser, right-click '(YourSolutionName)';
    2. Choose Properties;
    3. Go to the 'Compiling' tab, 'Output', 'Target framework', 'Change' and choose '.NET Framework 4.7.2',
  4. In your project properties, change the build events so only a single file is built:
    1. Go to the 'Compiling' tab, 'Output', 'Debug info' and choose 'No debug information';
    2. Right-click your .cs files -> Properties and change 'Copy to output' (If you haven't resized the properties bar, this will be truncated to 'Copy to out') to Never,
  5. In your project properties, fix the output location to put the DLL in the Assemblies folder:
    1. Go to the 'Compiling' tab, 'Output', 'Output path' and change the output path to '..Assemblies'.

Xamarin/MonoDevelop

The setup is similar as the one above. A few special points to address:

  1. Mono 4.X isn't backward compatible so you may need to install an older 3.X version of Mono in order to compile against .NET4.7.2 dlls.
  2. Make sure you uncheck 'Use MSBuild build engine (recommended for this project type)' under project > options > build > general (You might find this by right-clicking on your project - not solution - name and selecting options)
  3. Changing the framework to 4.7.2 can be found (for Linux anyway) in the same place.

Visual Studio 2017 For Mac

More detailed installation instructions for Linux can be found here and here.

Rider (good for Mac)

JetBrains Rider is a great cross-platform C# IDE, but it isn't cheap. It's $140 for the first year, including perpetual access to that version (access to future updates gets cheaper, but it's still over $100/year). However, the Early Access versions are a bit unstable but free. They also offer free student licenses.

  1. Open Rider and click New Solution in the welcome dialog.
    1. Click Class Library under .NET on the left. The option may a second to show up.
    2. Under Solution Name (and Project Name), enter the name of your mod.
    3. Set the Solution Directory to [your mod folder]/Source.
    4. Optionally check 'put solution and project in the same directory.' This is probably a good idea.
    5. Change Framework to .Net Framework 4.7.2.
    6. Click Create.
  2. In the left side bar, expand your solution, right click your project (mod name with 'C#' icon) and click Properties.
    1. In the Properties window, select Configurations > Debug on the left and uncheck Debug Symbols.
    2. For both configurations, change the Output Path to ././Assemblies.
    3. Click OK.
  3. Expand your project, right click References and click Add Reference.
    1. Click Add From.
    2. Browse to the folder with the RimWorld DLLs (Mac: /Users/[username]/Library/Application Support/Steam/steamapps/common/RimWorld/RimWorldMac.app/Contents/Resources/Data/Managed).
    3. Select both Assembly-CSharp.dll and UnityEngine.dll and click OK.
    4. Expand Assemblies under References. For both of the assemblies that you just added:
      1. Right click the assembly and click Properties.
      2. Uncheck 'Copy Local' (you may need to scroll down) and click OK.

You're done! Note that Rider has a built-in decompiler—to view the source of a RimWorld class or method, just right-click its name and click Go To > Definition.

  • Can't find the option to target .NET Framework 4.7.2? It may require additional installation steps. In Visual Studio, Tools => Get Tools and features => Individual Components => Select .NET Framework 4.7.2 development tools (or google installation instructions). Also make sure your project is a Class Library (.NET Framework). Not .NET Core or .NET Standard.
  • Writing custom code continues on setting up your solution.
Retrieved from 'https://rimworldwiki.com/index.php?title=Modding_Tutorials/Setting_up_a_solution&oldid=72616'

When you open Visual Studio, there are a number of tool windows that let you interact with your code:

  1. The Code editor is where you write your code.
  2. The Solution explorer shows the files you're working with.
  3. The Properties pane gives additional information and context about selected parts of your project.
  4. The Output window displays debugging and error messages, compiler warnings, status messages, and other output.

You can add additional tool windows by using the View menu at the top. For example, the Bookmarks tool window lets you bookmark lines of code for quick access. The layout of your tool windows is highly customizable — you can add additional windows, remove the ones you have open, and move them around to best suit how you work.

Menus

At the top of the screen, you'll see Visual Studio's menus, which you'll use to run various commands. Here's a high level overview of the most important ones:

  1. The File menu contains commands to create, open, and save projects.
  2. The Edit menu contains commands to search, modify, and refactor your code.
  3. The View menu is where you go to open additional tool windows in Visual Studio.
  4. The Project menu lets you add files and dependencies in your project.
  5. The Debug menu contains commands to run your code and use debugger features.
  6. The Tools menu contains commands to change your settings, add functionality to Visual Studio via extensions, and access various Visual Studio tools.

Toolbar

The Visual Studio toolbar, shown below the menus, provides quick access to the most common commands.

You can change what commands the toolbar contains by going to View → Customize


I ran into an issueNext: Creating a project



broken image