Difference between revisions of "Tutorials:TSM Creating a game compatible Visual Studio project"

From SimsWiki
Jump to: navigation, search
(Requirements: Removed dead links and added VS2015)
(Step 6: Add References To the Sims Medieval Assemblies)
Line 41: Line 41:
 
*You'll find the assemblies at the following locations:
 
*You'll find the assemblies at the following locations:
 
**VS2010: At the top under the '''.NET''' tab.
 
**VS2010: At the top under the '''.NET''' tab.
**VS2012: Under <code>Assemblies > Framework</code> highlighted in white.
+
**VS2012/15: Under <code>Assemblies > Framework</code> highlighted in white.
 
*Add references to the following assemblies:
 
*Add references to the following assemblies:
 
**<code>GameplaySystems</code>
 
**<code>GameplaySystems</code>
Line 49: Line 49:
 
**<code>System.Xml</code>
 
**<code>System.Xml</code>
 
**<code>UI</code>
 
**<code>UI</code>
 +
 
====Step 7: All Done====
 
====Step 7: All Done====
 
Happy coding. :)
 
Happy coding. :)

Revision as of 20:34, 22 July 2015

Contents

Introduction

Unfortunately, you can't just go right ahead and begin crafting a mod for TSM in Visual Studio. There is a couple of things that you need to setup beforehand. Now you can either choose to follow this tutorial and do it yourself, or skip to the end where you can download the project template I've created.

Requirements

  • Microsoft Visual Studio
    • Visual C# 2008 Express (The Sims Medieval is a .NETv4 build which means that VS2008, and any prior versions, can't be used to craft mods for TSM)
    • Visual C# 2010 Express
    • Visual Studio Express 2012 for Windows Desktop
    • Visual Studio Community 2015
  • Any text editor, but I'd recommend using an editor with syntax highlighting like Notepad++ or Sublime Text 2.

Tutorial

Step 1: Getting Started

  • Download the customized The Sims Medieval .NET profile.
    • 32-bit: Extract the folder into C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile.
    • 64-bit: Extract the folder into C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile.

Step 2: Create a New Project

  • Choose the Visual C# Class Library template.
  • Try to keep the name unique by prefixing it with something like your nick. For example, DeeDawgModsFastForwarder.

Step 3: Remove All Existing References

  • Mark all references, which usually will be:
    • Microsoft.CSharp
    • System
    • System.Core
    • System.Data
    • System.Data.DataSetExtensions
    • System.Xml
    • System.Xml.Linq
  • Right-click and choose Remove.

Step 4: Additional Configuration

  • Save the solution and close Visual Studio.
  • Now locate the .csproj file in your solution folder, and open it with any text editor besides Visual Studio itself.
  • Inside the first PropertyGroup tag, you should be able to find the following line:
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  • Now add the following right below that line:
    <TargetCompactFramework>true</TargetCompactFramework>
    <TargetingClr2Framework>true</TargetingClr2Framework>
  • Close the text editor as you won't be needing it anymore.

Step 5: Change .NET profile

  • Open up your solution in Visual Studio again.
  • Go to Project > DeeDawgModsFastForwarder Properties. Keep in mind that it will be listed as the name of your own project.
  • Change the target framework to the .NET profile you installed earlier, .NET Framework 4 TheSimsMedieval Profile, and choose Yes on the dialog that'll pop-up.

Step 6: Add References To the Sims Medieval Assemblies

  • Right-click references and choose Add Reference....
  • You'll find the assemblies at the following locations:
    • VS2010: At the top under the .NET tab.
    • VS2012/15: Under Assemblies > Framework highlighted in white.
  • Add references to the following assemblies:
    • GameplaySystems
    • Metadata
    • SimIFace
    • System
    • System.Xml
    • UI

Step 7: All Done

Happy coding. :)


Download Project Template

This process can become quite trivial if you intend to create more than one mod. That's why I've created a project template, and here's how to use it:

  • Download the project template.
    • VS2010: Move the whole ZIP-archive to C:\<your user folder>\Documents\Visual Studio 2010\Templates\ProjectTemplates\Visual C#.
    • VS2012: Move the whole ZIP-archive to C:\<your user folder>\Documents\Visual Studio 2012\Templates\ProjectTemplates\Visual C#.
  • When you create a new project, choose the The Sims Medieval Library template.
Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox