简体   繁体   English

silverlight MatchTimeoutInMilliseconds bug:解析DomainServiceClientCodeGenerator

[英]silverlight MatchTimeoutInMilliseconds bug : resolve DomainServiceClientCodeGenerator

Silverlight 5 .Net Framework 4 Silverlight 5 .Net Framework 4

I am trying to implement a workaround for the recent bug in the RIA code generator "MatchTimeoutInMilliseconds could not be found" https://connect.microsoft.com/VisualStudio/feedback/details/1988437/generated-code-for-silverlight-references-matchtimeoutinmilliseconds-which-does-not-exist 我正在尝试为RIA代码生成器中最近的错误实现一种解决方法“无法找到MatchTimeoutInMilliseconds” https://connect.microsoft.com/VisualStudio/feedback/details/1988437/generated-code-for-silverlight-references -matchtimeoutinmilliseconds -这-不-不存在

I'm trying to use the workaround by Lazebnyy , But I can't seem to get DomainServiceClientCodeGenerator to resolve. 我正在尝试使用Lazebnyy的解决方法,但我似乎无法解决DomainServiceClientCodeGenerator

Lazebnyy writes: Lazebnyy写道:

Install RIAServices.T4 from Nuget in the WebProejct or a Class Library that will contain the the code generation classes. 从WebProejct中的Nuget或将包含代码生成类的类库安装RIAServices.T4。 PM> Install-Package RIAServices.T4 PM>安装包RIAServices.T4

Create two classes 创建两个类

 [DomainServiceClientCodeGenerator(typeof(MyServicesEntityGenerator),"C#")] public class MyServicesClientCodeGenerator : CSharpClientCodeGenerator { protected override EntityGenerator EntityGenerator { get { return new MyServicesEntityGenerator(); } } } public class MyServicesEntityGenerator : CSharpEntityGenerator { protected override void GenerateAttributes(IEnumerable<Attribute>attributes, bool forcePropagation) { List<Attribute> newAttributes = new List<Attribute>(attributes); List<Attribute> regularExpressionAttributes = (from c in attributes where c.GetType() == typeof(RegularExpressionAttribute) select c).ToList(); newAttributes.RemoveAll(delegate(Attribute attr) { return attr.GetType() == typeof(RegularExpressionAttribute); }); base.GenerateAttributes(newAttributes, forcePropagation); foreach (RegularExpressionAttribute item in regularExpressionAttributes) { base.Write(string.Format("[System.ComponentModel.DataAnnotations.RegularExpressionAttribute(@\\"{0}\\", ErrorMessage=@\\"{1}\\")]\\r\\n", item.Pattern, item.ErrorMessage)); } } } 

Now to hook it all up, in the Silverlight project file we need to tell RIA to use our generator. 现在要把它全部搞定,在Silverlight项目文件中我们需要告诉RIA使用我们的生成器。 We have to edit the Silverlight project and add the following element inside the first PropertyGroup just after LinkedServerProject (the order doesn't matter, I just say that as a reference). 我们必须编辑Silverlight项目并在LinkedServerProject之后的第一个PropertyGroup中添加以下元素(顺序无关紧要,我只是说作为参考)。

 <LinkedServerProject>..\\RIAServicesLibrary.Web\\RIAServicesLibrary.Web.csproj</LinkedServerProject> <RiaClientCodeGeneratorName>RIAServicesLibrary.Web.Helpers.MyServicesEntityGenerator</RiaClientCodeGeneratorName> 

.

No matter what I try, I can't seem to resolve DomainServiceClientCodeGenerator 无论我尝试什么,我似乎无法解析DomainServiceClientCodeGenerator

[DomainServiceClientCodeGenerator(typeof(MyServicesEntityGenerator),"C#")]
  1. I got the Nuget package RIAServices.T4 Version 4.2.0, 我得到了Nuget包RIAServices.T4版本4.2.0,
  2. Added the references in the server side service project to Microsoft.ServiceModel.DomainServices.Tools.dll Microsoft.ServiceModel.DomainServices.Tools.TextTemplate.dll 将服务器端服务项目中的引用添加到Microsoft.ServiceModel.DomainServices.Tools.dll Microsoft.ServiceModel.DomainServices.Tools.TextTemplate.dll
  3. I've included the namespaces in the code 我在代码中包含了名称空间

     using Microsoft.ServiceModel.DomainServices.Tools; using Microsoft.ServiceModel.DomainServices.Tools.TextTemplate.CSharpGenerators; using Microsoft.ServiceModel.DomainServices.Tools.TextTemplate; 

Digging through the namespaces, all I can find is DomainServiceClientCodeGeneratorAttribute and IDomainServiceClientCodeGenerator 挖掘名称空间,我能找到的是DomainServiceClientCodeGeneratorAttributeIDomainServiceClientCodeGenerator

Can anyone tell me how to resolve my missing DomainServiceClientCodeGenerator ? 谁能告诉我如何解决我丢失的DomainServiceClientCodeGenerator

I spent about 4 hours in order to get working Silverlight 5 + Ria Services SP1 project created in Visual Studio 2012 + Windiws 7 + .NET Framework 4 in Visual Studio 2015 + Windows 10 in order to fix this error. 我花了大约4个小时才能在Visual Studio 2015 + Windows 10中的Visual Studio 2012 + Windiws 7 + .NET Framework 4中创建Silverlight 5 + Ria Services SP1项目以修复此错误。

Initially I could not get it working in Visual Studio 2015 at all. 最初我根本无法在Visual Studio 2015中使用它。

So I installed Visual Studio 2013 (Complete Type Installation) + Service Pack 5 and I get less errores. 所以我安装了Visual Studio 2013(完整类型安装)+ Service Pack 5 ,我得到的错误更少。

After this I installed all old Silverlight stuff like WPF Toolkit and after this I just opened solution and unique error was about 在此之后,我安装了所有旧的Silverlight之类的东西,比如WPF Toolkit ,之后我就打开了解决方案并且出现了独特的错误

silverlight MatchTimeoutInMilliseconds bug : resolve DomainServiceClientCodeGenerator silverlight MatchTimeoutInMilliseconds bug:解析DomainServiceClientCodeGenerator

So without extra changes of the project properties I installed .Net Framework 4.6.2 Preview 因此,如果没有对项目属性进行额外更改,我安装了.Net Framework 4.6.2 Preview

AND THIS ERROR GONE!!! 而这个错误已经消失!

I compiled fine this solution and after this I was able to compile it under Visual Studio 2015. 我编译好了这个解决方案,之后我能够在Visual Studio 2015下编译它

I hope the time I spent will help to someone. 我希望我花的时间对某人有所帮助。

I finally got it working. 我终于搞定了。 The project needed reference to System.ComponentModel.Composition 该项目需要引用System.ComponentModel.Composition

This key piece of information came from http://jeffhandley.com/archive/2010/10/28/RiaServicesT4WalkUp.aspx 这条关键信息来自http://jeffhandley.com/archive/2010/10/28/RiaServicesT4WalkUp.aspx

You'll notice that I needed to add a reference to Microsoft.ServiceModel.DomainServices.Tools for this to work. 您会注意到我需要添加对Microsoft.ServiceModel.DomainServices.Tools的引用才能使其正常工作。 That assembly is in our framework (not the Toolkit) and it's where the DomainServiceClientCodeGeneratorAttribute class is defined. 该程序集位于我们的框架中(而不是Toolkit),它是定义DomainServiceClientCodeGeneratorAttribute类的地方。 Also, in order for this to compile, I needed to add a reference to System.ComponentModel.Composition (MEF) because that attribute class actually derives from ExportAttribute. 此外,为了编译它,我需​​要添加对System.ComponentModel.Composition(MEF)的引用,因为该属性类实际上派生自ExportAttribute。

... ...

(for anyone wondering, this did not solve the MatchTimeoutInMilliseconds bug for me) (对于任何想知道的人,这并没有解决我的MatchTimeoutInMilliseconds错误)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Silverlight错误找不到类型或命名空间名称“MatchTimeoutInMilliseconds” - Silverlight error The type or namespace name 'MatchTimeoutInMilliseconds' could not be found 这是Silverlight InkPresenter中的错误吗? - Is this a bug in Silverlight InkPresenter C#生成的文件中的“ MatchTimeoutInMilliseconds”错误 - 'MatchTimeoutInMilliseconds' error in c# generated file Silverlight 4 BitmapImage错误:在SetSource()之后未调用ImageOpened - Silverlight 4 BitmapImage bug : ImageOpened not invoked after SetSource() 解析在Silverlight中用于渲染的“真正”字体 - Resolve the font “really” used for rendering in Silverlight 无法解析TargetName - Silverlight4 C# - Cannot resolve TargetName - Silverlight4 C# Silverlight Prism无法解析加载的模块,但并非总是如此 - Silverlight Prism fails to resolve modules on load but not always 如何从Silverlight更改跨度的文本,或者这是一个bug? - How do you change the text of a span from silverlight, or is this a bug? Silverlight 4资源流或Json Xml Dictionary Reader中的明显错误 - Apparent bug in Silverlight 4 Resource Streams or Json Xml Dictionary Reader ***。tmp不是有效的win32资源文件。 如何解决Visual Studio上的这个奇怪的错误? - ***.tmp is not a valid win32 resource file. How to resolve this weird bug on Visual Studio?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM