Diferencia entre revisiones de «Modding:Referencia IDE»

(Comienzo de traducción)
 
(Please use the file naming convention described in Ayuda:Edición)
 
(No se muestran 6 ediciones intermedias de 2 usuarios)
Línea 1: Línea 1:
 
←[[Modding:Índice|Índice]]
 
←[[Modding:Índice|Índice]]
 +
 +
{{Traducir}}
  
 
Esta página es una referencia rápida de cómo usar Visual Studio 2017 o MonoDevelop/Visual Studio para Mac al crear o editar un mod SMAPI. Ve a [[Modding:Modder Guide/Get Started|Modding:Modder Guide]] para la guía principal.
 
Esta página es una referencia rápida de cómo usar Visual Studio 2017 o MonoDevelop/Visual Studio para Mac al crear o editar un mod SMAPI. Ve a [[Modding:Modder Guide/Get Started|Modding:Modder Guide]] para la guía principal.
Línea 6: Línea 8:
 
<ul>
 
<ul>
 
<li>Debes instalar [https://visualstudio.microsoft.com/vs/community/ Visual Studio Community] (Windows), o [https://visualstudio.microsoft.com/vs/mac/ Visual Studio for Mac] (Mac).</li>
 
<li>Debes instalar [https://visualstudio.microsoft.com/vs/community/ Visual Studio Community] (Windows), o [https://visualstudio.microsoft.com/vs/mac/ Visual Studio for Mac] (Mac).</li>
<li>[http://www.monodevelop.com/ MonoDevelop] era usado para Linux, pero no sirve para las versiones actuales. Si estás en Linux, deberás usar VisualStudio en una máquina virtual, o una versión EAP de [https://www.jetbrains.com/rider/nextversion/ Rider].</li>
+
<li>Si estás en Linux, deberás usar VisualStudio en una máquina virtual, o una versión EAP de [https://www.jetbrains.com/rider/nextversion/ Rider]. (Anteriormente se usaba [http://www.monodevelop.com/ MonoDevelop] para Linux, pero ya no funciona.)</li>
<li>Reviewing [https://mva.microsoft.com/en-us/training-courses/c-fundamentals-for-absolute-beginners-16169 ''C# Fundamentals for Absolute Beginners''] is strongly recommended if you're new to programming C#.</li>
+
<li>Se recomienda revisar [https://mva.microsoft.com/es-mx/training-courses/c-fundamentals-for-absolute-beginners-16169 ''Conceptos básicos de C# para principiantes''] si C# es nuevo para ti.</li>
<li>Here are some basic terms to remember:
+
<li>Estos son algunos términos que recordar:
  
 
{| class="wikitable"
 
{| class="wikitable"
Línea 30: Línea 32:
 
===Windows (Visual Studio 2019/2022)===
 
===Windows (Visual Studio 2019/2022)===
 
# Abre Visual Studio 2019/2022.
 
# Abre Visual Studio 2019/2022.
# Click ''Create a new project'' from the start screen.<br />[[File:Modding - IDE reference - create project (Visual Studio 1).png]]
+
# Seleccionar ''Crear un proyecto'' en la pantalla de inicio.<br />
# Filter by "C#" and "Library", then choose ''Class Library'' and click ''Next''. Make sure you '''don't''' choose ''Class Library (.NET Framework)'' which won't work.<br />[[File:Modding - IDE reference - create project (Visual Studio 2).png| 589px]]
+
[[File:Modding - IDE reference - create project (Visual Studio 1) ES.png]]
# In the ''configure your new project'' window: <ol><li>Enter a descriptive mod name. By convention, the name should be one word with mixed caps (like "PineapplesEverywhere").</li><li>Make sure "Place solution and project in the same directory" is ''not'' checked.</li><li>Click "Create" to to create the project.</li></ol>[[File:Modding - IDE reference - create project (Visual Studio 3).png|800px]]
+
# Filtra por "C#" y "Librería", luego escoge ''Biblioteca de clase'' y haz click en ''Siguiente''. Asegúrate de '''no''' escoger ''Biblioteca de clase (.NET Framework)'', porque esa no funcionará.<br />[[File:Modding - IDE reference - create project (Visual Studio 2) ES.png|500px]]
# Next, select NET 5.0 and click "Create" to create the project. For VS 2022, this will be on the next page. <br/>[[File:Screenshot 2021-12-16 140835.png]]
+
# En la pantalla de ''configurar proyecto'': <ol><li>Ingresa un nombre de mod descriptivo. Como regla, el nombre debe ser una palabra con capitalización (como "ManzanasPorDoquier").</li><li>Asegúrate de que "Colocar solución y proyecto en el mismo directorio" ''no'' esté activado.</li><li>Haz click en "Crear" para crear el proyecto.</li></ol>[[File:Modding - IDE reference - create project (Visual Studio 3) ES.png]]
 +
# Luego, selecciona NET 6.0 y haz click en "Crear" para crear el proyecto. En VS 2022, esto estará en la página siguiente. <br/>
 +
[[File:Screenshot 2021-12-16 140835 ES.png]]
  
===Linux (MonoDevelop)===
+
===Linux (Rider)===
# Open MonoDevelop.
+
# Instala la SDK de .NET 6.0 si no lo has hecho ([https://learn.microsoft.com/es-mx/dotnet/core/install/linux link]).<br />
# Click ''File » New Solution'' from the menu bar:<br />[[File:Modding - IDE reference - create project (MonoDevelop 1).png]]
+
# Abre Rider.
# In the 'New Project' window, choose ''.NET » Library'' and click ''Next'':<br />[[File:Modding - IDE reference - create project (MonoDevelop 2).png]]
+
# Haz click en ''New Solution'' desde la barra de menú (derecha superior):<br />
# Enter a descriptive mod name. By convention, the name should be one word with mixed caps (like "PineapplesEverywhere"):<br />[[File:Modding - IDE reference - create project (MonoDevelop 3).png]]
+
[[File:Modding - IDE reference - create project (Rider 1) ES.png|600px]]
# Make sure "create a project directory within the solution directory" is checked, and click ''Create'':<br />[[File:Modding - IDE reference - create project (MonoDevelop 4).png]]
+
# En la ventana de proyecto, haz click en ''Class Library'':<br />
 +
[[File:Modding - IDE reference - create project (Rider 2) ES.png|500px]]
 +
# Ingresa un nombre de mod descriptivo. Como regla, el nombre debe ser una palabra con capitalización (como "ManzanasPorDoquier"):<br />
 +
# Asegúrate de que "Target framework" sea ''net6.0'', y "Language" sea ''C#'':<br />
 +
[[File:Modding - IDE reference - create project (Rider 3) ES.png|500px]]
  
 
===MacOS (Visual Studio 2019 for Mac)===
 
===MacOS (Visual Studio 2019 for Mac)===
  
# Instala la SDK de .NET 5.0 si no lo has hecho (link: [https://dotnet.microsoft.com/es-es/download/dotnet/5.0]).<br />[[File:1a NET website.png|600px]]
+
# Instala la SDK de .NET 6.0 si no lo has hecho ([https://dotnet.microsoft.com/es-es/download/dotnet/6.0 link]).<br />
 +
[[File:1a NET website ES.png|600px]]
 
# Abre Visual Studio para Mac.
 
# Abre Visual Studio para Mac.
 
# Haz click en ''Archivo » New Solution'' from the menu bar:<br />[[File:VS Mac 1 newsolution.png|600px]]
 
# Haz click en ''Archivo » New Solution'' from the menu bar:<br />[[File:VS Mac 1 newsolution.png|600px]]
Línea 60: Línea 69:
 
==Selecciona la fuente de trabajo==
 
==Selecciona la fuente de trabajo==
 
<span id="set-target-framework"></span>
 
<span id="set-target-framework"></span>
La 'target framework' (fuente de trabajo) es la versión de .NET que tu código usa, lo que afecta la versión necesitada para usar tu mod. Se recomienda .NET 5.0, que es la versión que SMAPI usa. '''Por favor revisa la versión de tu sistema operativo''' (Windows/Mac). '''Desde SDV 1.6, se usa .NET 6.0'''.
+
La 'target framework' (fuente de trabajo) es la versión de .NET que tu código usa, lo que afecta la versión necesitada para usar tu mod. Se recomienda .NET 6.0, que es la versión que SMAPI usa en 1.6. '''Por favor revisa la versión de tu sistema operativo''' (Windows/Mac).
 
 
===In Windows Visual Studio 2019/2022===
 
'''NOTE: Visual Studio 2017 MAY no longer be compatible with creating mods!''' If you followed [[Modding:Modder_Guide/Get_Started]] and receive errors, from the code that page instructed be copy and pasted, with regards to helper. Events in the Entry(IModhelper helper) method and ButtonPressedEventArgs from the Entry(IModHelper helper) method, try the project-creation and code-copy/paste process again with Visual Studio 2019/2022 instead.
 
  
 +
===In Windows Visual Studio 2022===
  
 
# Open the Solution Explorer pane. If it's not visible, click ''View » Solution Explorer'' from the menu:<br />[[File:Modding - IDE reference - show solution pane (Visual Studio).png]]
 
# Open the Solution Explorer pane. If it's not visible, click ''View » Solution Explorer'' from the menu:<br />[[File:Modding - IDE reference - show solution pane (Visual Studio).png]]
Línea 189: Línea 196:
 
[[Category:Modding]]
 
[[Category:Modding]]
  
 +
[[en:Modding:IDE reference]]
 
[[ru:Модификации:Настройка среды разработки]]
 
[[ru:Модификации:Настройка среды разработки]]
 
[[zh:模组:IDE 参考]]
 
[[zh:模组:IDE 参考]]

Revisión actual del 21:41 29 feb 2024

Índice

Robin building.png
Todavía tengo mucho trabajo por hacer
— Robin

Traducción incompleta

Este artículo o sección no ha sido completamente traducido al español. Le invitamos a ayudar en su construcción editándolo
Ultima Edición por Margotbean en 2024-02-29 21:41:32.


Esta página es una referencia rápida de cómo usar Visual Studio 2017 o MonoDevelop/Visual Studio para Mac al crear o editar un mod SMAPI. Ve a Modding:Modder Guide para la guía principal.

Antes de comenzar

  • Debes instalar Visual Studio Community (Windows), o Visual Studio for Mac (Mac).
  • Si estás en Linux, deberás usar VisualStudio en una máquina virtual, o una versión EAP de Rider. (Anteriormente se usaba MonoDevelop para Linux, pero ya no funciona.)
  • Se recomienda revisar Conceptos básicos de C# para principiantes si C# es nuevo para ti.
  • Estos son algunos términos que recordar:
    term definition
    IDE El programa usado para editar, correr, y compilar tu código (abreviación de Integrated Development Environment en inglés, o Entorno de Desarrollo Integrado ). Las IDEs principales son Visual Studio en Windows, y MonoDevelop/Visual Studio para Linux o Mac.
    DLL El archivo con extensión .dll que contiene tu código (abreviación de Dynamic Link Library en inglés, o Biblioteca de enlace dinámico). Este es el archivo que SMAPI lee al cargar tu mod.
    proyecto Colección de codigo fuente + configuración + recursos (como imágenes) que editas en la IDE. Cada proyecto es compilado en su propio DLL.
    solución Un conjunto de proyectos con una configuración global. La solución no es compilada, pero tiene características convenientes (como dejar que los proyectos hagan referencia a otros).

Crea un proyecto de mod

Antes de escribir tu código, debes crear una solución y proyecto que lo contenga.

Windows (Visual Studio 2019/2022)

  1. Abre Visual Studio 2019/2022.
  2. Seleccionar Crear un proyecto en la pantalla de inicio.

 

  1. Filtra por "C#" y "Librería", luego escoge Biblioteca de clase y haz click en Siguiente. Asegúrate de no escoger Biblioteca de clase (.NET Framework), porque esa no funcionará.
     
  2. En la pantalla de configurar proyecto:
    1. Ingresa un nombre de mod descriptivo. Como regla, el nombre debe ser una palabra con capitalización (como "ManzanasPorDoquier").
    2. Asegúrate de que "Colocar solución y proyecto en el mismo directorio" no esté activado.
    3. Haz click en "Crear" para crear el proyecto.
     
  3. Luego, selecciona NET 6.0 y haz click en "Crear" para crear el proyecto. En VS 2022, esto estará en la página siguiente.

 

Linux (Rider)

  1. Instala la SDK de .NET 6.0 si no lo has hecho (link).
  2. Abre Rider.
  3. Haz click en New Solution desde la barra de menú (derecha superior):

 

  1. En la ventana de proyecto, haz click en Class Library:

 

  1. Ingresa un nombre de mod descriptivo. Como regla, el nombre debe ser una palabra con capitalización (como "ManzanasPorDoquier"):
  2. Asegúrate de que "Target framework" sea net6.0, y "Language" sea C#:

 

MacOS (Visual Studio 2019 for Mac)

  1. Instala la SDK de .NET 6.0 si no lo has hecho (link).

 

  1. Abre Visual Studio para Mac.
  2. Haz click en Archivo » New Solution from the menu bar:
     
  3. Select the correct type of class library:
     
  4. Set it to target .NET 5.0.:
     
  5. Enter a descriptive mod name for the project. By convention, the name should be one word with mixed caps (like "PineapplesEverywhere"):
     

MacOS (Visual Studio for Mac)

  1. Open Visual Studio for Mac.
  2. Click File » New Solution from the menu bar:
     
  3. In the 'New Project' window, choose .NET » Library and click Next:
     
  4. Enter a descriptive mod name. By convention, the name should be one word with mixed caps (like "PineapplesEverywhere"):
     
  5. Make sure "create a project directory within the solution directory" is checked, and click Create:
     

Selecciona la fuente de trabajo

La 'target framework' (fuente de trabajo) es la versión de .NET que tu código usa, lo que afecta la versión necesitada para usar tu mod. Se recomienda .NET 6.0, que es la versión que SMAPI usa en 1.6. Por favor revisa la versión de tu sistema operativo (Windows/Mac).

In Windows Visual Studio 2022

  1. Open the Solution Explorer pane. If it's not visible, click View » Solution Explorer from the menu:
     
  2. From the Solution Explorer, right-click on the project and choose Properties:
     
  3. On the Application tab, change the Target Framework dropdown to .NET 5.0:
     
  4. A dialogue may appear asking you to confirm the change. Click 'Yes' to confirm:
     

In Visual Studio 2019 for Mac

If you followed the instructions above to set up your project, your framework should already be set to .NET 5.0. However, if you picked the wrong class library or you just want to check, you can follow these steps to look at the .csproj file, which is basically equivalent to setting it manually. (If you're checking that it worked, don't replace the .csproj, just check it refers to .NET 5.0.)

Unfortunately there doesn't appear to be a way to change the target framework using the GUI. However, it is very easy to follow the 1.5.5 migration guide steps:

  1. Open the .csproj file for editing:
     
  2. Replace your mod's .csproj file with this (where EXAMLE_MOD_NAME is your solution's name):
<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <AssemblyName>EXAMPLE_MOD_NAME</AssemblyName>
    <RootNamespace>EXAMPLE_MOD_NAME</RootNamespace>
    <Version>1.0.0</Version>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="4.0.0" />
  </ItemGroup>
</Project>
  1. If the mod uses Harmony, add <EnableHarmony>true</EnableHarmony> to the property group.

In MonoDevelop/Visual Studio for Mac

This section is out of date for Stardew Valley 1.5.5. It appears you cannot change the .NET framework in this way with Visual Studio 2019 and Stardew Valley 1.5.5.

  1. Open the Solution pad. If it's not visible, click View » Pads » Solution from the menu:
     
  2. From the Solution pad, right-click on the project and choose Options:
     
  3. On the Build » General tab, change the Target Framework dropdown to Mono / .NET 4.5:
     

Add a file

In Visual Studio 2017

  1. Open the Solution Explorer pane. If it's not visible, click View » Solution Explorer from the menu:
     
  2. From the Solution Explorer pane, right-click on the project and choose Add » New Item:
     
  3. From the 'Add New Item' window, choose the file type (usually Visual C# Item » Class):
     
  4. Enter a descriptive file name and click Add:
     

In MonoDevelop/Visual Studio for Mac

  1. Open the Solution pad. If it's not visible, click View » Pads » Solution from the menu:
     
  2. From the Solution pad, right-click on the project to delete and choose Add » New File:
     
  3. From the 'New File' window, choose the file type (usually General » Empty Class):
     
  4. Enter a descriptive file name and click New:
     

Delete a file

In Visual Studio 2017

  1. Open the Solution Explorer pane. If it's not visible, click View » Solution Explorer from the menu:
     
  2. From the Solution Explorer pane, right-click on the file to delete and choose Delete:
     

In MonoDevelop/Visual Studio for Mac

  1. Open the Solution pad. If it's not visible, click View » Pads » Solution from the menu:
     
  2. From the Solution pad, right-click on the file to delete and choose Remove:
     

Add a NuGet package

In Visual Studio 2019/2022

  1. Click Tools » NuGet Package Manager » Manage NuGet Packages for Solution from the menu:
     
  2. Note: if the nuget package manager is missing, you can add it as a package source with the following steps: https://stackoverflow.com/questions/37293242/nuget-package-manager-no-packages-found-even-though-the-package-exists
  3. On the Browse tab, search for the package and click on the result to display some options:
     
  4. In the options, check the box next to your project and click Install:
     
  5. If a 'Review Changes' dialogue appears, click OK:
     

In Visual Studio 2019 for Mac

  1. Click Project » Manage NuGet Packages... from the menu:
     
  2. Search for the package, click on the result, and click Add Package:
     
  3. Quit and relaunch Visual Studio.

In MonoDevelop/Visual Studio for Mac

  1. Click Project » Add NuGet Packages from the menu:
     
  2. Search for the package, click on the result, and click Add Package:
     

Edit project file (.csproj)

Sometimes you may want to edit the project file directly (mainly to configure build steps). The project is a .csproj file, and can be edited from within the IDE.

In Visual Studio 2017

  1. Open the Solution Explorer pane. If it's not visible, click View » Solution Explorer from the menu:
     
  2. From the Solution Explorer pane, right-click on the project and choose Unload:
     
  3. Right-click on the project again and choose Edit <project name>.csproj:
     
  4. Make your changes in the editor that appears and save.
  5. When you're done, right-click on the project again and choose Reload Project:
     

In MonoDevelop/Visual Studio for Mac

  1. Open the Solution pad. If it's not visible, click View » Pads » Solution from the menu:
     
  2. From the Solution pad, right-click on the project and choose Tools » Edit File:
     
  3. Make your changes in the editor that appears and save.

Find compiled files

In Visual Studio 2017

  1. Open the Solution Explorer pane. If it's not visible, click View » Solution Explorer from the menu:
     
  2. From the Solution Explorer pane, right-click on the project and choose Open Folder in File Explorer:
     
  3. Navigate to bin\Debug (or bin\Release if you switched to release build configuration).

In MonoDevelop/Visual Studio for Mac

  1. Open the Solution pad. If it's not visible, click View » Pads » Solution from the menu:
     
  2. From the Solution pad, right-click on the project and choose Open Containing Folder:
     
  3. Navigate to bin/Debug (or bin/Release if you switched to release build configuration).

Add a reference to another DLL

In Visual Studio 2017

  1. Open the Solution Explorer pane. If it's not visible, click View » Solution Explorer from the menu:
     
  2. From the Solution Explorer pane, right-click on References and choose Add Reference...:
     
  3. From the 'Reference Manager' window, choose Browse in the left side, then click Browse.. at the bottom:
     
  4. Find the DLL you want to reference, select it, and click Add:
     
  5. From the 'Reference Manager' window, click OK: