Difference between revisions of "Sims 3:Creating a game compatible Visual Studio project"

From SimsWiki
Jump to: navigation, search
(Step 3: Set the project to not reference mscorlib.dll)
(Step 4: Add references to the Sims 3 assemblies)
Line 59: Line 59:
 
* Select all of the Sims 3 assemblies. The assemblies you want to add are mscorlib, ScriptCore, SimIFace, Sims3GameplayObjects, Sims3GameplaySystems, Sims3StoreObjects, Sims3Metadata, System, System.Xml, and UI.
 
* Select all of the Sims 3 assemblies. The assemblies you want to add are mscorlib, ScriptCore, SimIFace, Sims3GameplayObjects, Sims3GameplaySystems, Sims3StoreObjects, Sims3Metadata, System, System.Xml, and UI.
 
* Click OK.
 
* Click OK.
 +
 +
'''VS 2012 Users:''' You will see the following warning when you compile:
 +
<blockquote>
 +
1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Sims3Metadata", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
 +
</blockquote>
 +
 +
To prevent this warning, you must change your project from Any CPU to x86. Use the drop down menu in the second tool bar to do this. You may need to use the Configuration Manager to add x86 to the drop down menu.
  
 
<div style="clear:both"></div>
 
<div style="clear:both"></div>

Revision as of 21:32, 18 January 2013

Contents

Step 1: Create a New Project

Sims 3-VS New Project.png
  • Set the framework version to .NET Framework 2.0.
  • Use the Visual C# Class Library template.
  • Preferably prefix the name of the library with your name / handle. Eg, Gibbed.Sims3Game.Test is what I would use. —Rick

Step 2: Remove all existing references

Sims 3-VS Remove References.png
  • Select all references, this is usually System, System.Data, and System.Xml..
  • Right-click the selected references, and select Remove.

Step 3: Set the project to not reference mscorlib.dll

Sims 3-VS Do Not Reference.png
  • Open the project properties.
  • Set the active configuraiton to All Configurations.
  • Change to the Build tab.
  • Click Advanced to open the Advanced Build Settings window.
  • Check Do not reference mscorlib.dll and click OK.

VS 2010 and 2012 Users will have to manually alter the .csproj in order to reference the correct mscorlib.dll. The process is the same for both versions of VS.

  1. Save your project and close VS.
  2. Go to the folder where you VS project is saved and find the .csproj file for your project.
  3. Right-click on file and choose Edit with Notepad++. If you don't have Notepad++ you may need to choose NotePad from a list of programs.
  4. Between the last </PropertyGroup> and the the first existing <ItemGroup>, add this:
<ItemGroup>
    <Reference Include="mscorlib">
      <HintPath>... Path to where Sims 3 mscorlib.dll is on your computer ...</HintPath>
      <Private>False</Private>
    </Reference>
</ItemGroup>

Note: you can also just drop this into the same <ItemGroup></ItemGroup> as your other references.

5. Save the .csproj and close Notepad++. Try to open your project in VS now. If your get an error when you try to open your project, you probably forgot to close a node somewhere in your .csproj, or you may have use the wrong path for mscorlib.
6. If your project opened without errors, continue to Step 4.


Step 4: Add references to the Sims 3 assemblies

Sims 3-VS Add References.png
Sims 3-VS Add References Browse.png

You will need to have already extracted and decrypted the Sims 3 assemblies to do this step. See Getting Started with Scripting Modding if you haven't done this already.

  • Right-click the References item in the Solution Explorer.
  • Select Add Reference....
  • Select the Browse tab.
  • Select all of the Sims 3 assemblies. The assemblies you want to add are mscorlib, ScriptCore, SimIFace, Sims3GameplayObjects, Sims3GameplaySystems, Sims3StoreObjects, Sims3Metadata, System, System.Xml, and UI.
  • Click OK.

VS 2012 Users: You will see the following warning when you compile:

1>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1578,5): warning MSB3270: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Sims3Metadata", "x86". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

To prevent this warning, you must change your project from Any CPU to x86. Use the drop down menu in the second tool bar to do this. You may need to use the Configuration Manager to add x86 to the drop down menu.

Step 5: Set the references to not Copy Local

Sims 3-VS Select References.png
Sims 3-VS Set Copy Local.png
  • Select all references.
  • Set the Copy Local property to False.

Step 6: Fin

You're now ready for coding. :)

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox