GTFO Modding
  • 🏠Home
    • 🫂Contributing
  • Guides
    • 📖The Complete Newbie Guide
    • The Newbie Level Guide
      • Isolating a level
      • Editing rundown and level metadata
      • Adding and editing zones
      • Editing warden objective
      • Adding a secondary sector
      • Final datablocks version
    • The Newbie Git Guide
    • 👶Your First Plugin
      • Setting up Visual Studio Community
      • Creating a C# class library project
      • Writing a Plugin class
      • Compiling for release
      • Creating a Patch class
      • Patching in slightly more detail
    • 🎹Adding Custom Audio
      • Project Setup
      • Adding Sounds into Wwise
      • Creating a Sound Event
      • Creating a SoundBank
      • Using SoundBanks in GTFO
    • ⛏️Datamining
      • Audio files
      • Export asset files from GTFO
      • Import asset files to Unity
      • Fixing Unity errors after importing
    • Introduction to Errors
    • Modded GTFO on Linux
    • Enabling MTFO Hot Reload
    • VS Code Tips
    • Creating Custom Weapons
    • External Guides
  • Reference
    • Datablocks
      • Main
        • Archetype
        • BigPickupDistribution
        • ChainedPuzzle
        • ComplexResourceSet
        • ConsumableDistribution
        • Dimension
        • EnemyBalancing
        • EnemyBehavior
        • Enemy
        • EnemyDetection
        • EnemyGroup
        • EnemyMovement
        • EnemyPopulation
        • EnemySFX
        • ExpeditionBalance
        • FlashlightSettings
        • FogSettings
        • GearCategory
        • Gear
        • Item
        • ItemFPSSettings
        • LevelLayout
        • LightSettings
        • MeleeAnimationSet
        • MeleeArchetype
        • Player
        • PlayerOfflineGear
        • Recoil
        • Rundown
        • SurvivalWavePopulation
        • SurvivalWaveSettings
        • Text
        • VanityItemsTemplate
        • WardenObjective
        • Weapon
      • Rarely Edited
        • Artifact
        • ArtifactDistribution
        • ArtifactTag
        • Atmosphere
        • BoosterImplantCondition
        • BoosterImplantEffect
        • BoosterImplantTemplate
        • ChainedPuzzleType
        • Clouds
        • CustomAssetShard
        • EnvironmentFeedback
        • Feedback
        • GameSetup
        • GearCategoryFilter
        • GearFlashlightPart
        • GearFrontPart
        • GearMagPart
        • GearMeleeHandlePart
        • GearMeleeHeadPart
        • GearMeleeNeckPart
        • GearMeleePommelPart
        • GearPartAttachment
        • GearReceiverPart
        • GearSightPart
        • GearStockPart
        • GearToolDeliveryPart
        • GearToolGripPart
        • GearToolMainPart
        • GearToolPayloadPart
        • GearToolScreenPart
        • GearToolTargetingPart
        • ItemMovementAnimation
        • ItemPart
        • MarkerGroup
        • MeleeSFX
        • MiningMarker
        • MLSArrayDescriptorReference
        • MusicState
        • PlayerDialog
        • ServiceMarker
        • StaticSpawn
        • TechMarker
        • TextCharacterMeta
        • VanityItemsGroup
        • VanityItemsLayerDrops
        • WeaponAudio
        • WeaponMuzzleFlash
        • WeaponShellCasing
      • Unused
        • Commodity
        • EffectNode
        • EventSequenceAction
        • EventSequence
        • ExtractionEvent
        • FogScenario
        • GameplayTrailer
        • GearDecal
        • GearPalette
        • GearPattern
        • GearPerk
        • LevelGenSettings
        • Loot
        • Recepie
    • Nested Types
      • AbilityData
      • ActiveEnemyWaveData
      • AltitudeData
      • AnimHash
      • ArtifactLayerData
      • ArtifactZoneDistribution
      • AssetData
      • BigPickupSpawnData
      • BoosterImplantEffectInstance
      • BuildLayerFromData
      • BuildSeedData
      • BulkheadDoorPlacementData
      • ChainedPuzzleComponent
      • ConsumableSpawnData
      • CustomTerminalCommand
      • DescriptiveData
      • DialogActorSettings
      • DialogDramaFilter
      • DialogLine
      • DialogStructure
      • DialogStructureHolder
      • DimensionData
      • DimensionInExpeditionData
      • DOFSettingsData
      • DumbwaiterPlacementData
      • EffectNodeListData
      • EffectNodePrefabData
      • EnemyGroupCompositionData
      • EnemyRoleData
      • EnemySpawningData
      • ESA_EnemyWave
      • ESA_FogSettings
      • ESA_Lights
      • ESA_PostEffect
      • ESA_Sound
      • EventSequenceActionListComponent
      • ExpeditionData
      • ExpeditionIndex
      • ExpeditionInTierData
      • ExpeditionZoneData
      • FeedbackAudioCompData
      • FeedbackEffectCompData
      • FunctionPlacementData
      • GameEventSound
      • GameplayTrailerDirectorAction
      • GearArchetypeData
      • GearCategoryFilterData
      • GearDropPeriodData
      • GearPartAlignData
      • GearPartAlignPriority
      • GearPartGeneralData
      • GearPerkModifierData
      • GearPicker
      • GearSightPartProperties
      • GearSpecialPerkData
      • GeneralFogDataStep
      • GenericEnemyWaveData
      • HealthData
      • ItemPartData
      • LayerData
      • LayerDropData
      • LanguageData
      • LevelEventData
      • LevelEventNoiseData
      • LevelEventSoundData
      • LevelEventWardenIntelData
      • LevelGenConfig
      • LightCategorySetting
      • LinkedSlaveModelData
      • LocalizedText
      • Loot
      • MarkerComposition
      • MarkerDataCommon
      • MeleeAttackData
      • MinMaxValue
      • ModelData
      • MusicEventData
      • MusicEventDataConditional
      • MusicEventDataTimed
      • MusicSwitchData
      • MusicSwitchDataOnCustomCue
      • MusicSwitchDataTimed
      • ProgressionPuzzleData
      • ReactorWaveData
      • ReactorWaveEnemyData
      • ResourceData
      • RundownStorytellingData
      • RundownStorytellingVisualData
      • RundownTierProgressionData
      • SpecialExpeditionOverridesData
      • SpecificChainPuzzleSpawnData
      • SpecificPickupSpawnData
      • SpecificTerminalSpawnData
      • StaticEnemyData
      • StaticSpawnDataContainer
      • StaticSpawnPrefabDistancePair
      • TerminalLogFileData
      • TerminalOutput
      • TerminalPlacementData
      • TerminalStartStateData
      • TerminalZoneSelectionData
      • TierVisualData
      • TimingData
      • TypeAndGeneralData
      • VanityItemsDropData
      • Vector3AnimationCurve
      • WardenObjectiveEventData
      • WardenObjectiveLayerData
      • WeaponAnimSequenceItem
      • WorldEventConditionPair
      • WorldEventFromSourceData
      • ZonePlacementData
      • ZonePlacementWeights
    • Enum Types
  • Mods Documentation
    • Noteworthy Mods
    • Documentation
      • StealthAdjustment
      • DynamicCustomCombatMusic
      • ConfigurableGlobalWaveSettings
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Guides
  2. Your First Plugin

Creating a C# class library project

How to set up your project for editing and compiling

We will be creating a Library project written in C# targeting all platforms

First create a new project and choose "Class Library" - "A project for creating a classlibrary that targets .NET or .NET Standard"

Then write a name into the Project name field, such as "MyFirstPlugin" and click "Next"

Next ensure you have ".NET 6.0 (Long-term support)" selected as your Framework and click "Create"

When the project is finished creating you should see "Class1.cs" open

Click Project > Edit Project File and replace it with the following

The following project settings assume you have r2modman installed in the Default location with BepInEx installed and run at least once

You can change which r2modman profile is used by editing the Profile property Additionally, you can also change the BepInEx path to your preferred location by editing the BepInEx property

<Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>

		<!--
		Use the following property to set your preferred r2modman profile
		-->
		<Profile>Default</Profile>

		<TargetFramework>net6.0</TargetFramework>
		<ImplicitUsings>enable</ImplicitUsings>
		<Nullable>enable</Nullable>
		<DebugType>None</DebugType>
		<AssemblyName>$(SolutionName)</AssemblyName>
		<RootNamespace>$(SolutionName)</RootNamespace>
		<BepInEx>$(AppData)\r2modmanPlus-local\GTFO\profiles\$(Profile)\BepInEx</BepInEx>
		<BuildDirectory>$(BepInEx)\plugins\$(SolutionName)\</BuildDirectory>
		<OutputPath>$(BuildDirectory)</OutputPath>	
		<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
	</PropertyGroup>
	<Target Name="PostBuild" BeforeTargets="PostBuildEvent">
		<Delete Files="$(OutputPath)$(AssemblyName).deps.json" />
	</Target>
	<ItemGroup>
		<Reference Include="$(BepInEx)\core\0Harmony.dll" Private="false" />
		<Reference Include="$(BepInEx)\core\BepInEx.Core.dll" Private="false" />
		<Reference Include="$(BepInEx)\core\BepInEx.Unity.IL2CPP.dll" Private="false" />
		<Reference Include="$(BepInEx)\core\Il2CppInterop.Common.dll" Private="false" />
		<Reference Include="$(BepInEx)\core\Il2CppInterop.Runtime.dll" Private="false" />
		<Reference Include="$(BepInEx)\interop\*.dll" Private="false" />
		<Reference Remove="$(BepInEx)\interop\netstandard.dll" />
	</ItemGroup>
</Project>

Finally save the changes to the csproj file

You should now be ready to create your Plugin class

PreviousSetting up Visual Studio CommunityNextWriting a Plugin class

Last updated 7 months ago

Was this helpful?

👶