I am using this example from microsoft to call web services dynamically using reflection:
http://blogs.msdn.com/b/kaevans/archive/2006/04/27/dynamically-invoking-a-web-service.aspx
Which works fine in a web page project, however in a console application the class
ServiceDescriptionImporter
Is unavailable (doesnt come up in intellisense and isnt recognized as part of the assembly it belongs to -- System.Web.Services.Description). Which is wierd b/c it DOES come up in web projects.
Anyone know why this is? I cannot get the console app to work. This is a VS 2010 project.
ServiceDescriptionImporter is in the System.Web.Services assembly. Add a reference to that, and import the namespace with a using System.Web.Services.Description; statement, and it will work.
I also met this problem.
when I went to change the target framework, I found the default target is .Net Framework 4 client profile, also there has a .Net Framework 4 exist.
I changed the target from .Net Framework 4 client profile to .Net Framework 4, and then it's working, the ServiceDescriptionImporter appeared.
hope this helps for others.
Related
I converted one of our commonly used libraries to .NET standard 2.0 for mobile application use as well as use in existing applications.
Using this library in an existing Mvc application (4.7.1 Framework) it builds and runs successfully but the Visual Studio IDE reports a list of build errors for the controller classes around not being able to find elements of the library. The using clause of this library is also greyed out in the controller classes.
Is there an easy way to resolve this?
Upgrading from MVC 5.2.3 to 5.2.6 has solved.
I currently have a WCF project in my solution that compiles with .net 4.5.2
It builds and deploys to my local IIS
The issue I am having is reference this WCF service in another project in the same solution.
I made a new solution just to be sure. There was just a class library project, .net 4.5.2 and I could connect to the service and download the metadata.
On the solution I need it to work, it only works if my target framework is .net 4.5
I have no idea why it doesn't run in .net 4.5.2
Please indicate in comments what more you need from me, as I cannot see what could be the issue.
As I said, the service is deployed working in IIS. I can browse to it on localhost and view the svc.
Referencing the service in a different solution running 4.5.2 works, as the namespace works and I can use the code.
But not the solution I want it to work in. Only on 4.5, not 4.5.2
It connects but the namespace doesn't exist/seem to work and I cannot see the codes and methods
I have a winforms app whcih calls a wcf service. In the wcf service, I have this error:
Could not load file or assembly (and then details of an assembly which is one of my projects).
This started happening out of the blue, how can I ensure that the assembly loads?
Thanks
I suggest you use the Assembly Binding Log Viewer to find out why your assembly is not loading.
This is out of the blue, but I ran into this problem when I started using VS2010. When you create a new project like a winforms app or console app the default .net type is set by VS as .net 4 Client Profile. For whatever reason, when the project is set to this .net framework, some libraries will not load and all you will get is the above error message when trying to compile, in my case it would never load the Castle Windsor libraries I use in all of my projects, the fix being set it to .NET 4 only (no client profile) or .NET 3.5 by going to the project in Solution Explorer -> properties, then set the .net framework.
I'm trying to experiment with Microsoft.Web.Administration on my Windows 7 x64 box, using Visual Studio 2010. When I add the DLL to references in my C# project, I can see its namespaces and classes pop up in Intellisense.
But as soon as I build, I get "The type or namespace name 'Web' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)", and I get build errors in the code I've written, as if the DLLs aren't even there.
There are two sets of IIS7 DLLs that I can see, in:
%windir%\system32\inetsrv
%windir%\syswow64\inetsrv
But both sets seem to do the same thing: Apparently initially work, then fail on build.
Does anyone know what I need to do to get this working?
If this is a .NET 3.5 or .NET 4.0 project, open the project properties. On the Application tab it will have probably defaulted to either of:
.NET Framework 3.5 Client Profile
.NET Framework 4 Client Profile
Change this to .NET Framework 3.5 or .NET Framework 4. Your project should then build just fine.
As the compiler error points out, Microsoft.Web.Administration has a dependency on System.Web which isn't referenced in the 3.5/4.0 client profiles.
I started a new winforms project, fairly simple, has a few labels, text boxes, and a button. All code is running fine. I forgot to change the framework version from 4 (using VS 2010) to 3.5 before I created the app and when I changed it to 3.5 or 3.5 client profile I get the following warning:
The primary reference "Microsoft.CSharp", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5". To resolve this problem, either remove the reference "Microsoft.CSharp" or retarget your application to a framework version which contains "Microsoft.CSharp".
It's not a huge amount of trouble to recreate this with a 3.5 setting from the start and I'm fairly sure I'm not using anything from the 4 framework that I need.
In most/all project templates in VS 2010 for .NET 4, the Microsoft.CSharp assembly reference is added. So when you created the project you were given this assembly reference automatically. You shouldn't have any problems just removing the reference.
I just wish to add my experience too. In my case, removing the Microsoft.CSharp reference was enough just to take the warnings away and compile the solution, however while using the console I got some errors still referring to the missing frameworks reference.
I then created an empty new console project; by default the ".NET FrameWork 4 Client Profile" was set, so I immediately replaced it with the ".NET Framework 3.5 Client Profile" option and saved. Then I copy&paste all my code from the original project and add all the references I used in the project. Then I renamed the solution, namespace, assembly name, etc, like my original project and compiled it. No warnings/errors and everything was OK.
I then tried to use the console application (on an environment with just the .NET 3.5) and everything worked flawless ^_^ (instead, just changing the .NET reference from 4 to 3.5 in the project proprieties, I got the errors I said above).
Hope this may help those having problems while just changing the "targeted framework" and removing the Microsoft.CSharp reference in an existing project.