Skip to content

Instantly share code, notes, and snippets.

@darthwalsh
Last active August 25, 2022 21:55
Show Gist options
  • Save darthwalsh/f66f064c072876f4e50f to your computer and use it in GitHub Desktop.
Save darthwalsh/f66f064c072876f4e50f to your computer and use it in GitHub Desktop.
Minimal C# .NET Framework project - CS CSPROJ SLN
class Program
{
static void Main()
{
}
}
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition ="'$(Configuration)' == ''">Debug</Configuration>
<Platform Condition ="'$(Platform)' == ''">AnyCPU</Platform>
<ProjectGuid>{D1FFA0DC-0ACC-4108-ADC1-2A71122C09AF}</ProjectGuid>
<OutputPath>bin\$(Configuration)\</OutputPath>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<Compile Include="code.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "code", "code.csproj", "{D1FFA0DC-0ACC-4108-ADC1-2A71122C09AF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D1FFA0DC-0ACC-4108-ADC1-2A71122C09AF}.Debug|Any CPU.ActiveCfg = Debug|x86
{D1FFA0DC-0ACC-4108-ADC1-2A71122C09AF}.Debug|Any CPU.Build.0 = Debug|x86
{D1FFA0DC-0ACC-4108-ADC1-2A71122C09AF}.Release|Any CPU.ActiveCfg = Release|x86
{D1FFA0DC-0ACC-4108-ADC1-2A71122C09AF}.Release|Any CPU.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

Note, this is for .NET Framework! Nowadays you probably want to use dotnet new cli to make a dotnet core project.

If you've ever started a simple C# project in Visual Studio, it creates a lot of cruft in your project.

These are a minimal set of files that you can start writing a C# programs. I deleted most lines from a starter CSPROJ and SLN file to get this starter template.

These files open and build cleanly in:

  • msbuild
  • Visual Studio
  • Visual Studio Code
  • mono (xbuild)

Feel free to download these files and do whatever you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment