Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Ward <matt.ward@xamarin.com>2017-05-30 17:27:43 +0300
committerMatt Ward <matt.ward@xamarin.com>2017-05-30 17:27:43 +0300
commit549fabcf1b0396a204ba051df1ef494893aa934e (patch)
tree8aa446ca6dc7e23b008eee79df27c5698ce0fb0e /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools
parent78005ef18fb803207ab04e38f35ff9701ae57b75 (diff)
[Ide] Fix generated code for resx files in .NET Core projects
Fixed bug #56519 - ResX files produced for .NET Core generate code that does not compile https://bugzilla.xamarin.com/show_bug.cgi?id=56519 Projects that target .NET Core App 1.x or .NET Standard 1.x cannot compile code that uses "typeof(Resources).Assembly" which was generated by the ResXFileCodeGenerator. Now if these target frameworks are used by the project then the code generated uses "typeof(Resources).GetTypeInfo().Assembly" which is supported. .NET Core 2.0 and .NET Standard 2.0 do not require the use of GetTypeInfo.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs
index a946d40d95..86932983bc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/ResXFileCodeGenerator.cs
@@ -130,6 +130,13 @@ namespace MonoDevelop.Ide.CustomTools
static bool TargetsPcl2Framework (DotNetProject dnp)
{
+ // .NET Core 1.x and .NET Standard 1.x projects also need to be treated as though they target
+ // the PCL 2 framework so GetTypeInfo is used in the generated code. .NET Core 2.0 and
+ // .NET Standard 2.0 do not need to use GetTypeInfo.
+ string framework = dnp.TargetFramework.Id.Identifier;
+ if (framework == ".NETCoreApp" || framework == ".NETStandard")
+ return dnp.TargetFramework.Id.Version.StartsWith ("1.", StringComparison.Ordinal);
+
if (dnp.TargetFramework.Id.Identifier != TargetFrameworkMoniker.ID_PORTABLE)
return false;
var asms = dnp.AssemblyContext.GetAssemblies (dnp.TargetFramework);