我目前正在向一个使用共享代码项目作为主代码库的项目(XrmFakeEasy)中添加一些代码。
我想对以下代码路径进行更改:
#if FAKE_XRM_EASY_2016 || FAKE_XRM_EASY_365 || FAKE_XRM_EASY_9
// Connect to the CRM web service using a connection string.
CrmServiceClient client = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString);
return client;
#else
CrmConnection crmConnection = CrmConnection.Parse(connectionString);
OrganizationService service = new OrganizationService(crmConnection);
return service;
#endif目前,#if FAKE_XRM_EASY_2016 || FAKE_XRM_EASY_365 || FAKE_XRM_EASY_9和#else之间的代码是灰色的,智能感知/调试不能在上面工作。
有没有办法在灰色代码上获得智能感知,或者在共享代码项目上定义编译时间变量?
发布于 2020-03-24 18:36:05
有没有办法在灰色代码上获得智能感知,或者在共享代码项目上定义编译时间变量?
据我所知,就是这样设计的,没有改变它的选项。
在此类项目中,当前的if条件无效(由于false条件),处于非活动区域,这意味着项目的这一部分将不会被执行,因此无法获得其智能感知。
作为建议,您可以尝试为#if分配一个true条件,在您的情况下,请首先使用以下内容:
1)使用这个
#if true
////you can obtain the intellisense for this
#else
.....
#endif2)然后更改为:
#if false
.........
#else
//////add your code here with the related Intellisense
#endif3)然后更改为:
#if FAKE_XRM_EASY_2016 || FAKE_XRM_EASY_365 || FAKE_XRM_EASY_9
.........
#else
........
#endifhttps://stackoverflow.com/questions/60811631
复制相似问题