Skip to main content

Could not resolve mscorlib for target framework '.NETFramework,Version=v4.0'. This can happen if the target framework is not installed or if the framework moniker is incorrectly formatted wcf update service reference issue

I am feeling little good about writing this blog as this might help many, as i searched for the suggestion on the net for couple of days but may be i didn't google it properly (I can not say google does not have solution :) ), but finally if ends well everything is well, i got the solution of this nightmare kinda issues



The Issue

I faced this issue and i saw on the net the plenty like me had the same issue, that one fine morning your service reference stopped updating, or you can't do anything with them, which were working fine earlier, You can't update service reference, you can't delete them, once you remove everything and give the reference again, the error fires back again and you can't repeat the same procedure of deleting and inserting the reference over and over



See the following screen shot



Above is the screen shot which i kept on getting and searched for the solution with best of my googling capabilities untill i got the solution which is below, Before that there were many solutions like the classe names which WCF (wsdl) generates were larger than 256 characters, But i could not use that solution for some reason, other solutions were re intalling some of the MS tools and re installing them, Below is the solution which worked for me and i am posting so other can also make use of it

Solution

Creating a batch file instead of manually adding service reference (WCF reference) will only generate the wsdl files which is required to access the data of it and functions inside it and via which the above error will be gone

@ECHO OFF

set UIProjectServiceRefPath =..\..\MyApplication\ServiceReferences

set SVCUTILPATHValue =C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools

ECHO Generating CommonService.CS
"%SVCUTILPATHValue %\svcutil.exe" /o:"%UIProjectServiceRefPath %\CommonService.cs" /reference:"c:\MyDomainService\bin\Debug\Domain.dll" /serializer:Auto /edb /ct:System.Collections.Generic.List`1 /ixt  /namespace:*,MyService.CommonService http://localhost/MyService.BLL/CommonService.svc?wsdl

set /p delBuild=press any key to exit:

  • Create a .bat file (batch file) like above, very first line after echo is where you want to have those class files to be created, this would be same path where your WCF service reference were getting created, so replace your path having that in mind
  • Second Echo statement is your actual service file which you want to generate, now if you have 3 services, you will these type 3 echo statements with their respective paths, here /reference is any reference DLLs your WCF might be using, so give those DLLs path there, you can have multiple /reference nodes followed by one another
  • /namespace is via which you will be referencing your classes to create their objects, and .svc is your hosted WCF service, the path which you were using to add service reference.


Now remove your existing "Service reference" folder which you have generated from previous WCF manual add service reference from windows explorere and also from your solution, and doucle click this file, it will generate "ServiceReference" folder at the smae place and inside that it will put above .CS files which is in .dat file



Your are good to go, go to your solution include this folder and build your project, if you have configured it properly it will build with no error, and now whenever you want to update the service reference, just double click this file to generate new WSDLs



Feel free to comment here in case of any doubt, I would like to mention here the valuable help from http://k-sharp-net.blogspot.in/ (Kamlesh samnani, very good colleague of mine)

Comments

Post a Comment

Popular posts from this blog

High CPU to completely normal CPU - SXA issue, SXA pages not loading in mobile device

  Hi Team, Today i am going to share one of the nightmarish issue with you all, We are having Sitecore 9.1.1 hosted in azure PaaS environment Our site was working just fine and no noise, but we have been working on a feature release where 7-8 months of development needed to be released to production, Big GO LIVE event right?  Also to make the development smoother we also introduced BLUE/GREEN deployment slots in the same release, so we can easily SWAP slots and go live Everything went well, we went live, we even did load and performance testing on our staging and pre-prod and we were confident enough of results Very next day we started getting "SITE DOWN" alerts, and also product owners and clients mentioned that site is very slow for them in US time and in our morning when we were accessing it, it was working lighting fast so we were clue less at start, but we started digging  1) First thing caught our eyes were HIGH CPU spikes, in US time, also without any traffic CPU u...

Error in Sitecore 10.3 XM with CDs - Could not find configuration node: database/database[@id='master']

Hi Team, Recently we came across two distinct scenarios with same error message.  1) We started getting below error when we try to hit our layout service API endpoint. If we hit end point of CM, it was working fine and when we try to hit end point of CD it was giving this error, It was clear there is something in backend expecting master DB instead of WEB DB In first scenario my colleague  Jatin  also got same issue while setting up docker instance for 10.3, and my friend  Akshay Barve  and I had the same observation. 2) Second scenario I was having the same exception, It was another project on 10.3 XM with CD, It was one of the migration project so we were migrating from 10.2 to 10.3, Older site was not giving any error but new site the moment we hit, it was giving same exception in the log Issue in second scenario was in site grouping there was only site and both CM and CD URLs were given in host name and had WEB db as database, so basically there was no previ...

Experience Analytics not working

Hello Sitecorian, How many of you have encountered an error or the situation where graph on the experience analytics dashboard or graph on launchpad's dashboard is not working I recently encountered with this scenario where i was presented with the situation where simply graph was not coming up, Before digging completely into it and checking logs and everything, From very first high level thoughts pointed me to check Is the valid certificate is used for xconnect? Are thumbprints are correct in all configs ? We had scaled environment so i needed to check the thumbprint in all the needed roles. Is xconnect site is accessible from CD? Without any https exceptions? Is XDB is enable?  Is Tracking is enable?  Everything looked ok on first place, so i finally took my sleeves up and started digging into details, Below are the details steps and exceptions those were captured and i will also show you the topology of instances we were using. Scaled instance We are using...