[Solved] Can anyone tell me is possible to change the .Game PCL


#1

Does anybody know, is it possible to convert my MyGame.Game Portable Class Library into a regular .Net Class Library

My application does not need to be cross platform I only need to run it on my desktop but I need to implement a repository pattern with entity framework which is not supported by class libraries.

any help would be greatly appreciated


#2

If you perform the following patch to your game’s project, you will end up with a project that targets .NET Framework 4.6.1:

diff --git a/MyGame/MyGame.Game/MyGame.Game.csproj b/MyGame/MyGame.Game/MyGame.Game.csproj
index d5aa3db..d25d1eb 100644
--- a/MyGame/MyGame.Game/MyGame.Game.csproj
+++ b/MyGame/MyGame.Game/MyGame.Game.csproj
@@ -12,10 +12,7 @@
     <AssemblyName>MyGame.Game</AssemblyName>
     <DefaultLanguage>en-US</DefaultLanguage>
     <FileAlignment>512</FileAlignment>
-    <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
-    <TargetFrameworkProfile>
-    </TargetFrameworkProfile>
-    <TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
     <BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
   </PropertyGroup>
   <PropertyGroup>
@@ -111,7 +108,7 @@
     <Compile Include="BasicCameraController.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
-  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(SiliconStudioPackageProps)" Condition="Exists('$(SiliconStudioPackageProps)')" />
   <Import Project="$(SiliconStudioXenkoDir)\Targets\SiliconStudio.Common.targets" Condition="Exists('$(SiliconStudioXenkoDir)\Targets\SiliconStudio.Common.targets')" />
   <Target Name="EnsureSiliconStudioXenkoInstalled" BeforeTargets="PrepareForBuild">
@@ -125,4 +122,4 @@
   <Target Name="AfterBuild">
   </Target>
   -->
-</Project>
\ No newline at end of file
+</Project>
diff --git a/MyGame/MyGame.Game/project.json b/MyGame/MyGame.Game/project.json
index 57aede6..787df47 100644
--- a/MyGame/MyGame.Game/project.json
+++ b/MyGame/MyGame.Game/project.json
@@ -1,10 +1,11 @@
 {
-  "supports": {},
   "dependencies": {
-    "Microsoft.NETCore.Portable.Compatibility": "1.0.1",
     "NETStandard.Library": "1.6.0"
   },
   "frameworks": {
-    "netstandard1.4": {}
+    "net461": {}
+  },
+  "runtimes": {
+    "win": {}
   }
 }

#3

That worked perfectly, thanks a million!


#4

Alternatively, you could consider using Entity Framework Core which is cross-platform.


#5

I had tried this but it didn’t allow me to use fluent api as I couldn’t acces System.Data.Entity. From what I could find it won’t be included until Entity Framework 7 comes out. But thanks for the suggestion all the same.