Difference between revisions of "Sims 3:Creating a game compatible Visual Studio project"
(→Step 3: Set the project to not reference mscorlib.dll) |
m (added a simplified "No Mscorlib" answer for later visual studios.) |
||
(14 intermediate revisions by 3 users not shown) | |||
Line 24: | Line 24: | ||
* Click '''Advanced''' to open the '''Advanced Build Settings''' window. | * Click '''Advanced''' to open the '''Advanced Build Settings''' window. | ||
* Check '''Do not reference mscorlib.dll''' and click OK. | * Check '''Do not reference mscorlib.dll''' and click OK. | ||
+ | ** '''VS 2010 Users:''' In addition to ticking "Do not reference mscorlib.dll," you will have to add the mscorlib reference manually. This will be discussed in Step 6. | ||
+ | ** '''VS 2012 Users:''' You can skip this step. VS2012 and later does not have an option not to reference mscorlib. You will have to do it manually. This will be discussed in Step 6. | ||
− | '''VS2010 | + | ''Can't find the active Configuration in VS2010?'' |
− | + | ||
+ | * Go to Tools - Options | ||
+ | * Make sure Show all settings is ticked | ||
+ | * Then you will see projects and solutions in the list | ||
+ | * Click on projects and solutions and choose General | ||
+ | * Tick Show Advanced Build Settings | ||
+ | * Now you will have the option in the build tab | ||
Line 41: | Line 49: | ||
* Select the '''Browse''' tab. | * 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. | * 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. | ||
+ | ** '''VS 2010 & 2012 Users and later:''' Skip the mscorlib.dll. Step 6 will show you how to add this reference to your project. | ||
* Click OK. | * Click OK. | ||
+ | |||
<div style="clear:both"></div> | <div style="clear:both"></div> | ||
Line 54: | Line 64: | ||
<div style="clear:both"></div> | <div style="clear:both"></div> | ||
− | ==Step 6: Fin== | + | ==Step 6: Extra steps for VS 2010 & 2012 Users and later== |
+ | |||
+ | '''VS 2010 and 2012 Users''' will now have to manually alter the .csproj in order to reference the correct mscorlib.dll. The process is the same for both versions of VS. | ||
+ | |||
+ | # Save your project and close VS. | ||
+ | # Go to the folder where your VS project is saved and find the .csproj file for your project. | ||
+ | # Right-click on the file and choose Edit with Notepad++. If you don't have Notepad++ you may need to choose NotePad from a list of programs. | ||
+ | #*''Tip:'' In Notepad++, set the language to XML, so you can easily check for matching tags. | ||
+ | # Between the last </PropertyGroup> and the the first existing <ItemGroup>, add this: | ||
+ | <pre> | ||
+ | <ItemGroup> | ||
+ | <Reference Include="mscorlib"> | ||
+ | <HintPath>... Path to where Sims 3 mscorlib.dll is on your computer ...</HintPath> | ||
+ | <Private>False</Private> | ||
+ | </Reference> | ||
+ | </ItemGroup> | ||
+ | </pre> | ||
+ | |||
+ | ''Note:'' you can also just drop everything between the <ItemGroup></ItemGroup> tags above into the same <ItemGroup></ItemGroup> as your other references. | ||
+ | |||
+ | : 5. Save the .csproj and close Notepad++. Open your project in VS now. If you get an error when opening the project, you probably forgot to close a node somewhere in your .csproj, or you may have used the wrong path for mscorlib. | ||
+ | |||
+ | Not feeling like doing all that? This link will also share how to do it in 2 seconds: https://stackoverflow.com/a/35902373 | ||
+ | |||
+ | '''VS 2012 Users and later:''' 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. | ||
+ | |||
+ | [[Image:Cpu1.jpg|thumb]] | ||
+ | [[Image:Cpu2.jpg|thumb]] | ||
+ | [[Image:Cpu3.jpg|thumb]] | ||
+ | |||
+ | |||
+ | <div style="clear:both"></div> | ||
+ | |||
+ | ==Step 7: Fin== | ||
You're now ready for coding. :) | You're now ready for coding. :) |
Latest revision as of 17:52, 19 September 2019
Contents |
[edit] Step 1: Create a New Project
- 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
[edit] Step 2: Remove all existing references
- Select all references, this is usually System, System.Data, and System.Xml..
- Right-click the selected references, and select Remove.
[edit] Step 3: Set the project to not reference mscorlib.dll
- 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 Users: In addition to ticking "Do not reference mscorlib.dll," you will have to add the mscorlib reference manually. This will be discussed in Step 6.
- VS 2012 Users: You can skip this step. VS2012 and later does not have an option not to reference mscorlib. You will have to do it manually. This will be discussed in Step 6.
Can't find the active Configuration in VS2010?
- Go to Tools - Options
- Make sure Show all settings is ticked
- Then you will see projects and solutions in the list
- Click on projects and solutions and choose General
- Tick Show Advanced Build Settings
- Now you will have the option in the build tab
[edit] Step 4: Add references to the Sims 3 assemblies
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.
- VS 2010 & 2012 Users and later: Skip the mscorlib.dll. Step 6 will show you how to add this reference to your project.
- Click OK.
[edit] Step 5: Set the references to not Copy Local
- Select all references.
- Set the Copy Local property to False.
[edit] Step 6: Extra steps for VS 2010 & 2012 Users and later
VS 2010 and 2012 Users will now have to manually alter the .csproj in order to reference the correct mscorlib.dll. The process is the same for both versions of VS.
- Save your project and close VS.
- Go to the folder where your VS project is saved and find the .csproj file for your project.
- Right-click on the file and choose Edit with Notepad++. If you don't have Notepad++ you may need to choose NotePad from a list of programs.
- Tip: In Notepad++, set the language to XML, so you can easily check for matching tags.
- 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 everything between the <ItemGroup></ItemGroup> tags above into the same <ItemGroup></ItemGroup> as your other references.
- 5. Save the .csproj and close Notepad++. Open your project in VS now. If you get an error when opening the project, you probably forgot to close a node somewhere in your .csproj, or you may have used the wrong path for mscorlib.
Not feeling like doing all that? This link will also share how to do it in 2 seconds: https://stackoverflow.com/a/35902373
VS 2012 Users and later: 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.
[edit] Step 7: Fin
You're now ready for coding. :)