diff --git a/csharp/generate_protos.sh b/csharp/generate_protos.sh
index 1083d671c1..b37bdc6134 100755
--- a/csharp/generate_protos.sh
+++ b/csharp/generate_protos.sh
@@ -45,7 +45,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
# and old_extensions2.proto, which are generated with an older version
# of protoc.
$PROTOC -Isrc -Icsharp/protos \
- --csharp_out=csharp/src/Google.Protobuf.Test/TestProtos \
+ --csharp_out=csharp/src/Google.Protobuf.Test.CodeGen \
--descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \
--include_source_info \
--include_imports \
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs b/csharp/src/Google.Protobuf.Test.CodeGen/ForeignMessagePartial.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/ForeignMessagePartial.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/ForeignMessagePartial.cs
diff --git a/csharp/src/Google.Protobuf.Test.CodeGen/Google.Protobuf.Test.CodeGen.csproj b/csharp/src/Google.Protobuf.Test.CodeGen/Google.Protobuf.Test.CodeGen.csproj
new file mode 100644
index 0000000000..dd4cd84e56
--- /dev/null
+++ b/csharp/src/Google.Protobuf.Test.CodeGen/Google.Protobuf.Test.CodeGen.csproj
@@ -0,0 +1,15 @@
+
+
+
+ net451;netstandard1.0
+ ../../keys/Google.Protobuf.snk
+ true
+ true
+ False
+
+
+
+
+
+
+
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs b/csharp/src/Google.Protobuf.Test.CodeGen/MapUnittestProto3.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/MapUnittestProto3.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/MapUnittestProto3.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto2.cs b/csharp/src/Google.Protobuf.Test.CodeGen/TestMessagesProto2.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto2.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/TestMessagesProto2.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs b/csharp/src/Google.Protobuf.Test.CodeGen/TestMessagesProto3.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/TestMessagesProto3.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/Unittest.cs b/csharp/src/Google.Protobuf.Test.CodeGen/Unittest.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/Unittest.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/Unittest.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestCustomOptionsProto3.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestCustomOptionsProto3.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestCustomOptionsProto3.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImport.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestImport.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestImport.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestImport.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestImportProto3.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportProto3.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestImportProto3.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublic.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestImportPublic.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublic.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestImportPublic.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestImportPublicProto3.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestImportPublicProto3.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestImportPublicProto3.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestIssues.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestIssues.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestIssues.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestProto3.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestProto3.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestProto3.cs
diff --git a/csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs b/csharp/src/Google.Protobuf.Test.CodeGen/UnittestWellKnownTypes.cs
similarity index 100%
rename from csharp/src/Google.Protobuf.Test/TestProtos/UnittestWellKnownTypes.cs
rename to csharp/src/Google.Protobuf.Test.CodeGen/UnittestWellKnownTypes.cs
diff --git a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
index 7fff91283b..102c7acf2b 100644
--- a/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+++ b/csharp/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
@@ -10,6 +10,7 @@
+