Convert older VS project to SDK - THDigi/SE-ModScript-Examples GitHub Wiki
Moved to SE wiki: https://spaceengineers.wiki.gg/wiki/Modding/Tutorials/Convert_old_projects_to_new_SDK
Old content
If you have an older project and you want a quick conversion.-
Have your IDE (Visual Studio, etc) closed.
-
Move .csproj and .sln to mod root folder.
-
Optional: Where .csproj was, delete
bin
,obj
,.vs
folders, and.ruleset
and.user
files. -
Replace contents of .csproj with (ideally using anything but your IDE):
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>YourName.ModName</RootNamespace>
<TargetFramework>net48</TargetFramework>
<Platforms>x64</Platforms>
<LangVersion>6</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mal.Mdk2.ModAnalyzers" Version="*" />
<PackageReference Include="Mal.Mdk2.References" Version="*" />
</ItemGroup>
</Project>
Optionally change that RootNamespace, it only affects new classes.
- Open the .sln with a text editor and replace everything from
EndProject
to the end of file with:
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{YOUR_GUID_HERE}.Debug|x64.ActiveCfg = Debug|x64
{YOUR_GUID_HERE}.Debug|x64.Build.0 = Debug|x64
{YOUR_GUID_HERE}.Release|x64.ActiveCfg = Release|x64
{YOUR_GUID_HERE}.Release|x64.Build.0 = Release|x64
EndGlobalSection
EndGlobal
- Still in the .sln find-and-replace
YOUR_GUID_HERE
with your GUID at the end of the Project() line.
For example:
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PaintGun", "PaintGun.csproj", "{385E79A8-1D69-47D1-975D-8C653CA37322}
You'd use the 2nd one,385E79A8-1D69-47D1-975D-8C653CA37322
.
And you're done!