简体   繁体   English

Dynamics CRM,Web服务,编译错误,将值分配给自定义字段

[英]Dynamics CRM, Web Service, compile error assigning value to custom fields

Hi i'm having problems assigning a value to a custom field. 嗨,我在将值分配给自定义字段时遇到问题。

  • i've added multiple custom fields to our Dynamics CRM 4.0 installation. 我已将多个自定义字段添加到我们的Dynamics CRM 4.0安装中。 i've pressed publish. 我按了发布。

  • I've gone to Settings -> Customization -> Download Web Description Files, and downloaded the wsdl replacing my current one in the project 我去了“设置”->“自定义”->“下载Web描述文件”,并下载了替换我当前项目中的wsdl的wsdl

  • I've pressed Update Web Reference 我按了更新网络参考

In my code I recieve the BusinessEntity 在我的代码中,我收到了BusinessEntity

opportunity o = (opportunity)crmService.Retrieve(EntityName.opportunity.ToString(), guid, new AllColumns());

I am aware that getting AllColumns is bad practice 我知道获取AllColumns是不好的做法

When I then try and assign a value to a custom property like this 然后,当我尝试为这样的自定义属性分配值时

o.custom_stringproperty = "string value";

I get the following error when trying to compile 尝试编译时出现以下错误

'CrmProxy.CrmSdk.opportunity' does not contain a definition for 'custom_stringproperty' and no extension method 'custom_stringproperty' accepting a first argument of type 'CrmProxy.CrmSdk.opportunity' could be found (are you missing a using directive or an assembly reference?) 'CrmProxy.CrmSdk.opportunity'不包含'custom_stringproperty'的定义,并且找不到扩展方法'custom_stringproperty'接受类型为'CrmProxy.CrmSdk.opportunity'的第一个参数(是否缺少using指令或程序集引用?)

In Reference.cs the property is there in the opportunity class, intellisense shows the actual field when i look into the o. 在Reference.cs中,该属性位于机会类中,当我查看o时,intellisense将显示实际字段。 object. 宾语。

I can't for the life of me figure out what causes this, i've removed the reference and added it again, i've cleaned the project and rebuild it. 我一辈子都无法弄清楚是什么原因造成的,我删除了引用并再次添加了它,我清理了项目并重建了它。 i've tried lots of things, I hope anyone here can point me in the right direction or knows the cause for this error. 我已经尝试了很多方法,希望这里的任何人都能指出正确的方向,或者知道导致此错误的原因。

I found out what caused this error, I also use parts of this project in SSIS and thus have it deployed in the GAC, the solution I where trying to compile had the proper project included, but for some reason looked in the GAC when doing a compile, and looked in the project when doing intellisense. 我发现了导致此错误的原因,我还在SSIS中使用了该项目的一部分,并将其部署在GAC中,尝试编译的解决方案包含了正确的项目,但是出于某种原因,在执行进行编译,并在进行智能感知时查看项目。 thus when I deployed the updated version of the project into GAC to use it in SSIS, the compile error went away because the project dll and the gac version now where the same. 因此,当我将项目的更新版本部署到GAC中以在SSIS中使用它时,编译错误就消失了,因为项目dll和gac版本现在相同。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM