Просмотр исходного кода

fix build net46 on linux (#115)

* fix build net46 on linux

* fix post build

* test again

* test again
sunnycase 8 лет назад
Родитель
Сommit
e2c3cf808a

+ 1 - 1
.travis.yml

@@ -1,5 +1,5 @@
 language: csharp
-dotnet: 2.0.0
+dotnet: 2.1.2
 mono: none
 script:
 # build

+ 1 - 0
NuGet.config

@@ -8,6 +8,7 @@
     <add key="orleans-prerlease" value="https://dotnet.myget.org/F/orleans-prerelease/api/v3/index.json" />
     <add key="corefxlab" value="https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json"/>
     <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
+    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
     <add key="imageSharp" value="https://www.myget.org/F/imagesharp/api/v3/index.json"/>
   </packageSources>
   <config>

+ 12 - 1
src/MineCase.Client.Engine/MineCase.Client.Engine.csproj

@@ -11,6 +11,17 @@
     <DebugSymbols>true</DebugSymbols>
   </PropertyGroup>
 
+  <PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
+    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
+    <FrameworkPathOverride>$(NuGetPackageRoot)microsoft.targetingpack.netframework.v4.6\1.0.1\lib\net46\</FrameworkPathOverride>
+  </PropertyGroup>
+
+  <ItemGroup Condition="'$(TargetFramework)' == 'net46'">
+    <PackageReference Include="Microsoft.TargetingPack.NETFramework.v4.6" Version="1.0.1" ExcludeAssets="All" PrivateAssets="All" />
+
+    <Reference Include="System.Runtime" />
+  </ItemGroup>
+
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
     <DocumentationFile>bin\Debug\net46\MineCase.Client.Engine.xml</DocumentationFile>
   </PropertyGroup>
@@ -76,7 +87,7 @@
     <Folder Include="Data\" />
   </ItemGroup>
 
-  <Target Name="PostBuild" AfterTargets="PostBuildEvent">
+  <Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(OS)' == 'Windows_NT'">
     <Exec Command="cd /d $(TargetDir)&#xD;&#xA;$(SolutionDir)..\build\pdb2mdb $(TargetFileName)&#xD;&#xA;copy /y $(TargetDir)*.dll $(ProjectDir)..\MineCase.Client\Assets\Plugins\Framework\&#xD;&#xA;copy /y $(TargetDir)*.pdb $(ProjectDir)..\MineCase.Client\Assets\Plugins\Framework\&#xD;&#xA;copy /y $(TargetDir)*.mdb $(ProjectDir)..\MineCase.Client\Assets\Plugins\Framework\" />
   </Target>
 

Разница между файлами не показана из-за своего большого размера
+ 14 - 1
src/MineCase.Client.Scripts/MineCase.Client.Scripts.csproj


+ 9 - 8
src/MineCase.Core/MineCase.Core.csproj

@@ -2,6 +2,7 @@
 
   <PropertyGroup>
     <RootNamespace>MineCase</RootNamespace>
+    <TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <CodeAnalysisRuleSet>../../build/Analyzers.ruleset</CodeAnalysisRuleSet>
@@ -10,15 +11,12 @@
     <DebugType>full</DebugType>
     <DebugSymbols>true</DebugSymbols>
   </PropertyGroup>
-
-  <PropertyGroup Condition="'$(Configuration)' == 'TravisCI'">
-    <TargetFrameworks>netstandard2.0</TargetFrameworks>
+  
+  <PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
+    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
+    <FrameworkPathOverride>$(NuGetPackageRoot)microsoft.targetingpack.netframework.v4.6\1.0.1\lib\net46\</FrameworkPathOverride>
   </PropertyGroup>
-
-  <PropertyGroup Condition="'$(Configuration)' != 'TravisCI'">
-    <TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
-  </PropertyGroup>
-
+  
   <ItemGroup>
     <ProjectReference Include="..\MineCase.Nbt\MineCase.Nbt.csproj" />
   </ItemGroup>
@@ -33,6 +31,9 @@
 
   <ItemGroup Condition="'$(TargetFramework)' == 'net46'">
     <PackageReference Include="System.ValueTuple" Version="4.4.0" />
+    <PackageReference Include="Microsoft.TargetingPack.NETFramework.v4.6" Version="1.0.1" ExcludeAssets="All" PrivateAssets="All" />
+
+    <Reference Include="System.Runtime" />
   </ItemGroup>
 
   <ItemGroup Condition="'$(TargetFramework)' != 'net46'">

+ 13 - 5
src/MineCase.Nbt/MineCase.Nbt.csproj

@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
+    <TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
     <CodeAnalysisRuleSet>../../build/Analyzers.ruleset</CodeAnalysisRuleSet>
     <Configurations>Debug;Release;Appveyor;TravisCI</Configurations>
@@ -8,13 +9,20 @@
     <DebugSymbols>true</DebugSymbols>
   </PropertyGroup>
 
-  <PropertyGroup Condition="'$(Configuration)' == 'TravisCI'">
-    <TargetFrameworks>netstandard2.0</TargetFrameworks>
+  <PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
+    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
+    <FrameworkPathOverride>$(NuGetPackageRoot)microsoft.targetingpack.netframework.v4.6\1.0.1\lib\net46\</FrameworkPathOverride>
   </PropertyGroup>
 
-  <PropertyGroup Condition="'$(Configuration)' != 'TravisCI'">
-    <TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
-  </PropertyGroup>
+  <ItemGroup Condition="'$(TargetFramework)' == 'net46'">
+    <PackageReference Include="Microsoft.TargetingPack.NETFramework.v4.6" Version="1.0.1" ExcludeAssets="All" PrivateAssets="All" />
+    
+    <Reference Include="System" />
+    <Reference Include="System.Runtime" />
+    <Reference Include="System.ComponentModel" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
 
   <ItemGroup>
     <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" />

+ 10 - 6
src/MineCase.Protocol/MineCase.Protocol.csproj

@@ -1,6 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
+    <TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
     <RootNamespace>MineCase</RootNamespace>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
@@ -11,12 +12,9 @@
     <DebugSymbols>true</DebugSymbols>
   </PropertyGroup>
 
-  <PropertyGroup Condition="'$(Configuration)' == 'TravisCI'">
-    <TargetFrameworks>netstandard2.0</TargetFrameworks>
-  </PropertyGroup>
-
-  <PropertyGroup Condition="'$(Configuration)' != 'TravisCI'">
-    <TargetFrameworks>netstandard2.0;net46</TargetFrameworks>
+  <PropertyGroup Condition="'$(TargetFramework)' == 'net46'">
+    <RuntimeIdentifier>win7-x64</RuntimeIdentifier>
+    <FrameworkPathOverride>$(NuGetPackageRoot)microsoft.targetingpack.netframework.v4.6\1.0.1\lib\net46\</FrameworkPathOverride>
   </PropertyGroup>
 
   <ItemGroup>
@@ -27,6 +25,12 @@
     <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.4.0" />
     <PackageReference Include="StyleCop.Analyzers" Version="1.1.0-beta004" PrivateAssets="All" />
   </ItemGroup>
+
+  <ItemGroup Condition="'$(TargetFramework)' == 'net46'">
+    <PackageReference Include="Microsoft.TargetingPack.NETFramework.v4.6" Version="1.0.1" ExcludeAssets="All" PrivateAssets="All" />
+
+    <Reference Include="System.Runtime" />
+  </ItemGroup>
   
   <ItemGroup Condition="'$(TargetFramework)' != 'net46'">
     <PackageReference Include="Microsoft.Orleans.Core.Abstractions" Version="2.0.0-beta1" />

+ 3 - 1
src/MineCase.sln

@@ -1,7 +1,7 @@
 
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 15
-VisualStudioVersion = 15.0.27004.2005
+VisualStudioVersion = 15.0.27130.2003
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MineCase.Server", "MineCase.Server\MineCase.Server.csproj", "{8E71CBEC-5804-4125-B651-C78426E57C8C}"
 EndProject
@@ -151,6 +151,7 @@ Global
 		{D586FFBB-7265-47CF-AD80-77AC7ACB0FF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{D586FFBB-7265-47CF-AD80-77AC7ACB0FF1}.Release|Any CPU.Build.0 = Release|Any CPU
 		{D586FFBB-7265-47CF-AD80-77AC7ACB0FF1}.TravisCI|Any CPU.ActiveCfg = TravisCI|Any CPU
+		{D586FFBB-7265-47CF-AD80-77AC7ACB0FF1}.TravisCI|Any CPU.Build.0 = TravisCI|Any CPU
 		{D2E3FF57-9287-4584-B8A1-57E19D44E0AF}.Appveyor|Any CPU.ActiveCfg = Appveyor|Any CPU
 		{D2E3FF57-9287-4584-B8A1-57E19D44E0AF}.Appveyor|Any CPU.Build.0 = Appveyor|Any CPU
 		{D2E3FF57-9287-4584-B8A1-57E19D44E0AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -158,6 +159,7 @@ Global
 		{D2E3FF57-9287-4584-B8A1-57E19D44E0AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{D2E3FF57-9287-4584-B8A1-57E19D44E0AF}.Release|Any CPU.Build.0 = Release|Any CPU
 		{D2E3FF57-9287-4584-B8A1-57E19D44E0AF}.TravisCI|Any CPU.ActiveCfg = TravisCI|Any CPU
+		{D2E3FF57-9287-4584-B8A1-57E19D44E0AF}.TravisCI|Any CPU.Build.0 = TravisCI|Any CPU
 		{2974A4BE-85D2-454D-ACDE-B4BE63993B95}.Appveyor|Any CPU.ActiveCfg = Appveyor|Any CPU
 		{2974A4BE-85D2-454D-ACDE-B4BE63993B95}.Appveyor|Any CPU.Build.0 = Appveyor|Any CPU
 		{2974A4BE-85D2-454D-ACDE-B4BE63993B95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

Некоторые файлы не были показаны из-за большого количества измененных файлов