Reference.cs is empty when generating service client - visual-studio-2010

I am trying to setup a VS2010 project in VS2012 and have a problem with generating the service references. Somewhere it fails and Reference.cs becomes empty.
I looked at this:
WCF Service Reference generates an empty reference.cs due to DuplexBinding
But since the code is working for VS2010 I would prefer not to change anything.
I have tried this:
Sometimes adding a WCF Service Reference generates an empty reference.cs
Then it appears code in Reference.cs but some functions is missing so the project doesn´t work. Is there any known problems when doing this? I am totally stuck and need some ideas.
Thanks in advance!
/David

In the Add Service Reference dialog , click on 'Advanced', there uncheck the option 'Reuse reference types in this assembly'
I often encounter this problem, this workaround works most of the times.

Related

BizTalk 2013 application can't seem to 'see' it's referenced assemblies

I have a BizTalk 2013 application comprising of 3 projects - orchestration, schemas and maps.
In my orchestations project I have references to my maps and schemas projects within the same application.
However, when I try to select a map or schema using the referenced assemblies nothing is showing, not even the standard dll's such as System.XML or System.Configuration, the only thing I can see is Microsoft.XLANGs.BaseTypes.
I can see the references in the solution explorer but not when I try to use them in anywhere in the orchestration.
I had this problem before but can't remember how I resolved it, any suggestions?
I ran into the same issue today. The only reference I was seeing was the XLANG.BaseTypes.
Turned out I set build action to none one time when I needed to test something and didn't need this orchestration. Setting it back to BtsCompile fixed it.
After deleting and re-creating the entire project which I seemed not to be able to reference everything is building and referencing as normal. Not sure what caused it in the 1st place though, so still open to suggestions for that.
thanks

All project references have yellow triangles every time solution is loaded

All my project (from the same solution) references are marked with a yellow triangle. The projects are all set to the same .NET version (4.5.1). The error log says:
The project 'CommonLibrary' cannot be referenced.
A way to temporarily fix the issue is to either:
Remove and re-add the references
Right click and choose Add Service Reference and immediatelly cancel.
However, the triangles come back every time I start the solution.
The solution is build successfully regardless or the issue. The real issue is that Resharper acts like the references don't exist.
Another thing that might be relevant is that I have 2 projects that are supposed to be unloaded but they become active every time I load the solution.
Any idea what to do with the issue?
I had similar issues and it usually comes down to the Target Framework (Project>Properties>Application). I was working on a solution using .NET 4.6 and for some reason the default framework for new projects have a different target (in my case it was 4.5.2). So make sure you check all your project at the very least have the same target framework.
Do the following:
In vs choose: tools->options->resharper->options-> general-> click the clear caches button.
then close all your opened tabs and shut down vs2013.
finally, start vs2013 again.
Let me know if that worked for you.
Try switching to managed compatibility mode in VS2013
you can do that by going to tools->options..->General tab and check the Use managed compatibility mode
I had the same thing happen but didn't suspect the 24 warnings I was getting was related to this error: Error 1 Unable to locate the .Net framework aspnet_merge.exe tool on path '~\Photo Archive\Main\etc\tools'. You need to set the msbuild property 'AspnetMergeToolPath' to the folder containing this tool. ODOT.PhotoArchive.Web
Trying to set the MS build property led to a lot of research just to find out WHICH property to set. So, Agent Ransack to the rescue -- searched my drive for the most recent version of the tool and copied it to the directory Visual Studio was complaining about.
Rebuilt the project with the idea of clearing the error but then the 24 warnings also disappeared.
FYI -- this is an MVC project which will replace a classic asp project. This might be peculiar to MVC projects.
At any rate, there was a lot of chasing snipes before this was finally tried. So, where this is happening, try handling any errors no matter how remote the possibility is they're related to the issue.
I had the same problem as you can see in this picture.
Its reason was the hidden folder. I had hidden the folder containing the project files. I got rid of this problem by unchecking the hidden attribute of the root folder containing the project files and restarting the visual studio.
Check it once, you might have checked the folder to be hidden.

Failed to queue test run ... QTAgent32.exe

After freshly rebooting, I get the error in the title if I attempt to debug even the simplest, most trivial unit test.
It's the same problem as this question, but I don't see a good answer in there.
Any help anyone could provide would be appreciated immensely.
We were able to solve this problem by turning off IntelliTrace. Tools->Options->IntelliTrace, uncheck "Enable IntelliTrace".
This is a known bug per microsoft and one of the work arounds fixed it to me:
It looks like Visual Studio insists building projects that started
their life as a WCFService Application. After removing the WCF Service
Application specific tags from the csproj xml files, unit tests work
every time. I removed the following tags: Under Property Group: Remove
ProjectTypeGuids and StartArguments Remove entire ProjectExtensions
node
FYI, to edit a project file first right click and unload the project. Then right click again and edit project file. The removed attributes shouldn't affect the running of the WCF service
source

Visual Studio build error: claims member of class in other assembly doesn't exist

I have a website solution which contains a project with domain classes.
I have added a public auto property (get; set;) to one of the domain classes. A page on the website references this property - it was added to the page using IntelliSense.
The website project builds okay. But when I build the solution, I get the old 'Class does not contain a definition for Property' error. However, if I right click on the property in the aspx.cs file, it takes me right to the declaration in the domain class.
The other website project in the solution can call this property of the class without errors.
Actually using the website fails with the same exception.
Seems like Visual Studio is having some kind of weird episode here.
Any suggestions what might be going wrong?
Thanks
David
Edit: Here are some further observations in a series of steps.
Clean Solution (says 14 succeeded; there are 16 projects in the solution)
Build Solution (says 16 succeeded)
Rebuild Solution (fails as described)
Build Solution (fails as described)
At no point does the website actually work - it always gives the error.
It does appear to precompile successfully.
Edit 2:
I have removed the project reference and re-added it, but the problem remains.
Edit 3:
I have added a new webiste project to the solution and copied all the files across from the existing website to the new website. The problem exists in the new website as well as the existing one.
You might try using System.IO.FileSystemWatcher or one of the SysInternals tools to try to find out if the compiler is accessing an old, cached copy of your assembly somewhere.
Perhaps a reset of IIS or the Application Pools helps a bit?
Also, if the assembly is registered in the GAC, perhaps removing it and installing it back again might help.
Double check the Build Order and/or Dependencies on the project that is having difficulty finding the property. That project should require that the other project(s) build first.
Okay, the problem was that the class I was using (which reportedly didn't contain the particular property) is called Case. Despite C#'s supposed case sensitivity, presumably it somehow clashed with the reserved word 'case', and this caused the problem during compilation.
Fully qualifying the class name fixed the problem, but I think I might just rename the class 'ProbateCase'.
I have to say this is clearly a bug in Visual Studio's compilation process. Not only should 'Case' not equal 'case' in c#, but also the class has existed in my solution for about a year and a half and this problem has never arisen before. Other projects can freely use the class without qualifying its name.
Grumble over. Life goes on.

VS 2010 Error “Object reference not set to an instance of an object” when adding Service Reference for WCF Service

I have a VS2010 (RTM) solution which contains:
WCF Service project
Console WCF client project
Class project for DataContracts and members
Class project for some simple classes
I successfully added a service reference in the console client project and ran the client. I then did a long dev cycle repeatedly modifying the service then updating console service reference. I then changed the namespace and assembly names for the projects as well as the .cs using references and app.config. I of course missed some things as it would not build so I eventually removed the project references and the service reference, cleaned and built successfully.
I then attempted to add the service reference again, it discovered it but threw the “Object reference not set to an instance of an object” when OK'ing. Fix in answer below...
This problem will be observed if you try to add a service reference to a project, but there is an existing service reference in the same project, to another project that you have unloaded. For example, you can use the following steps to reproduce:
Create two separate WCF service projects, Service1 and Service2
Create a Client project and add a service reference to a service in the Service1 project
Unload the Service1 project
In the client project, try to add a reference to a service in the Service2 project - you will get the above error
Although this shouldn't happen since the services are independent, the fix is to reload the Service1 project while you add the reference to Service2.
Posting my own fix as I couldn't find it elsewhere:
Stackoverflow'ing/Googling didn't get me anywhere so I eventually opened the solution file in notepad and found that the entry referencing my console project had a project dependency on the WCF Service project.
After I removed that ProjectSection, I was able to add the service reference and was back in business.
In trying to reproduce the problem, adding the service reference to the project adds the service project dependency but removing the service reference does not. I presume changing the namespace was the culprit with it not finding the dependency reference?
There is an existing project dependency between the service and the client.
Right Click on Consumer Project -> Project Dependencies;
Uncheck the dependency between the Consumer and Service. (This will remove any internal objects or references from the consumer)
Retry: Add service reference.
To anyone having this problem and not helped with the above approaches :
See if the UI portion has some data bindings (in my case it was a datagrid control on a silverlight client) ymmv
Also, if you are having a service client, then the bindings in this form probably may come in the form of _Completed method, have a closer look into it to see if you are missing some data/parameters that ought to be there.
hth
Uninstall all versions of silver light SDKs (Silverlight, Silverlight3, etc) and Silverlight tools from the "Add/Remove Programs". Reinstall the Silverlight-tools, that should fix the issue.
Remove and re-add the service reference. Simple yet worked for me.
What caused the "object reference" error was simply changing the service reference endpoint url from local to my dev server. Never had this problem before except for this one time.
My Problem in vs17 (Object reference not set to an instance of an object):
So, I had renamed the Project in vs2015, but that didn't rename the folder that the project was in. When I opened it up in vs2017 and tried to ad a WCF Service, after clicking OK I would get object ref not found.
My Fix:
So, I unloaded the project file from the solution and renamed the project folder to match the project file, reloaded the project into my solution in vs2017, now I am able to "Add WCF Service"!

Resources