I have created a C# console application using visual studio 2010.
We are migrating our hosted sites a new server, and I have been set the task of checking the domains on the new server map to the same place as the domains on the old server.
I have been told do so using the following example:
https://docs.ar-soft.de/arsoft.tools.net/#DNS%20Client.html
This is all pretty new to me and I am on the edge of my understanding, but I just about understand what I need to do.
My problem is, when I add the following line of code:
DnsMessage dnsMessage = DnsClient.Default.Resolve("www.example.com", RecordType.A);
It is not recognising either the
DnsMessage
OR
DnsClient
As far as I can understand, both of these are in:
using System.Net;
Which is present on the page.
So what can I do to make this piece of code work?
This makes me think I am using the wrong type of project otherwise I cannot understand why it does not recognise these commands?
This brings me to a related side note. It seems to me I am missing something about C#, because I sometimes come across bits of code that are not recognised at all in the project I amusing, for example in some web applications I just cannot get a message box to appear, as again it does not seem to be recognised in the environment I am working in.
It seems that not all C# code can be run in all C# applications, so if this is the case, how can I tell what can be run and where?
This isn't built in. Per your documentation link, it's a 3rd party library called ARSoft.Tools.Net. You can install from NuGet:
Install-Package ARSoft.Tools.Net
You could also download the binaries from the project's codeplex site
Related
We use Windows Search in our application and need a way to detect is folder indexed.
I know 2 ways to do it:
1. Using Microsoft.Search.Interop.dll library.
2. Using Windows Search Sample Code (maybe a bit changed) as an .exe file called from C# application.
These two solutions need using an external file (.dll or .exe) but I need a simpler solution because it will be simple new optional SEARCH feature to a WebDAV server generated by wizard for our clients. Besides Microsoft.Search.Interop.dll is for .NET 2.0 and there can be a problem using it from IIS under .NET 4.0 pool (depending on pool settings).
Is there any way to use ISearchCrawlScopeManager interface without linking to any .dll (just to COM) like it was made in Crawl Scope Command Line C++ example?
UPDATE1: Looks like ISearchCrawlScopeManager interface is located in Search Interface Type Library. It isn't done yet, but I'm close. Thanks to Hans Passant.
At the head of my class (I am taking over a project from someone else), I have the following:
using Java.Util;
using Object = Java.Lang.Object;
using Void = Java.Lang.Void;
Void, is showing in red, with a "Cannot resolve symbol 'Void'" and cannot see what I may be missing.
I have checked the PC where this came from (and the application does build on that one) and have installed the same (yes, I saw, newer, but specifically installed the "same" items) Java items:
Java 7 Update 45
Java 6 Update 31
Java SE Development Kit 6 Update 31
This hasn't made any change.
I have checked the 'References' branch of the project and everything is showing the same (in fact, I cannot see a specific reference to Java anywhere)
Any help would be appreciated to sort this.
Please understand that I am not looking to change the code; just to get the code (as is) to compile without error.
[Update]
When I type out Java.Lang. the intellisense does not show Void in the dropdown list
[Further Update]
This project is tied to the development for a tablet; for which I hadn't installed some of the development software - installing these has resolved the issue and I can only assume that the Java namespace is buried within the software. Whilst there's no specific answer in the responses, most of the comments have certainly helped to steer me in the right direction.
There are several possible ways a C# project consuming Java bits,
Microsoft J#, which has been dead for a long time.
IKVM.NET, which originates from Mono.
dot42, a C# to Android compiler, which compiles C# to Android.
Xamarin.Android (aka Mono.Android).
Based on the fragment you pasted I think you might be opening a Xamarin.Android project in Visual Studio, as the using clauses match,
http://androidapi.xamarin.com/?link=N%3aJava.Util
http://androidapi.xamarin.com/?link=T%3aJava.Lang.Void
http://androidapi.xamarin.com/?link=T%3aJava.Lang.Object
Thus, you need to have Xamarin.Android completely installed on this machine. What you have (JRE and JDK) is obviously not enough.
dot42 does not have Java.Lang.Void and Java.Lang.Object, http://docs.dot42.com/Reference/NS.Java.Lang
I think these links would be helpful for you.
What is the difference between java.lang.Void and void?
http://docs.oracle.com/javase/7/docs/api/java/lang/class-use/Void.html
FAIL:
using Java.Lang.Void;
import Java.Lang.Void;
SUCCESS:
import java.lang.Void;
You have to use import instead of using.
import Java.Util.*;
Object blah = new Java.Lang.Object;
If you want to create an object that is null, do this:
Object obj = new Object();
If you want to add data set it equal to data such as a number.
obj = 7;
Additional info: I thought it might be helpful to say that my forms and classes are in the same solution as the already updated forms.
In our company we have this project which 3 people are working on it. One works on the database part, me and another colleague of mine are working on making the UI ready and relating it to database which is MS SQL Server 2012 and we are programming in C# in VS 2012.
The problem is that I made this one form ready, but the server version is ahead of me. That is, if I check in the whole program, I will damage the project as some forms has changed and the version I have is older. I tried right clicking and checking in only the forms and classes which I, myself made and I have their latest version. They check in without any error or anything, but the problem is, when my colleagues or myself(after deleting my source project) try to get latest version, my forms or classes doesn't show up.
We also tried to check in the whole program but only accept those pending changes which are made by me, still no success.
The problem is, we are kinda afraid to play with the server version as a lot of effort has gone into it.
Any help will be really appreciated as I'm stuck with this problem and the manager won't give me more parts of the program to make until we can come up with some way to deal with this.
You haven't mentioned merging at all but I think this is the answer to your question.
When you work on an older version of the code (because your local code is older, or maybe the whole branch of the code is older), you need to merge the code into the newer version. When you merge, any potential conflicts are detected and you can resolve all of them manually. There's obviously tools to help you - one is built into Visual Studio but you can replace it with an external tool which may work better for you. Either way, you need to decide how to merge the code. You have a few options:
take the whole code from the source (old code in this case),
take the whole code from the target (new code in this case),
merge the changes and take bits from each version based on your knowledge of the changes and how the code should look like.
As for why the forms don't show up, you probably didn't check in the changes to the project file so the new files are not part of the project as it exists in Team Services.
Conditions:
I've been asked to develop a simple ASP.NET 4(C#) project in notepad. I'm completely new to this area.
The completed project should include several .aspx files, one master page, one sitemap and a web.config.
The book I'm using is a beginner cook book, based on using Visual Studio 2010 Express.
Developing it on notepad is a requirement to this school assignment.
Questions:
As what I know now VS2010 has its built-in Development Web Server which notepad doesn't. Should I test .aspx files by opening notepad files in browser? Will tags with runat="server" work?
Is there any helpful site or post that you know?
How should I testing master page?
Forgive my noob questions. The most sites I can find is teaching people how to develop by using VS2010, which is like my book, instead of notepad. The schedule is tight so I need some help here. Thank you for your time. I'll also share my experience when I finish this assignment.
It's a little more complicated than "runat="server"".
To give a little bit of 101, you will need:
A web server. The most natural one to use is IIS. I believe you should be able to use Apache as well if you're feeling adventurous.
The application framework. Guess what, it's .NET! There's also Mono if you're not using IIS. The application framework should also include the compiler. C# is a compiled language, so before you can run the code, you will have to compile it first. This is slightly different when compared to PHP.
The editor. You should be able to use Notepad, but Visual Studio provides you with more than just a fancy text editor. It helps you create the build script (the command that you send to the compiler), it helps you with project organization, and it helps you debugging.
So just using Notepad is doable, but you'll lose so much time for not using a free tool like Visual Studio Express.
Now to actually answer your questions:
No, it doesn't work that way. You will need a web server (see point 1 above) and a compiler (see point 2 above).
That's a little bit too broad. Your book should be a good starting point.
See answer 1.
I have finished that assignment. Here is my experience:
First, to develop an ASP.NET project on notepad or textpad is very unwise, unless you want to test your coding skill or having some other reasons. Because for beginner the best way to test your code is using VS "Ctrl+F5". If you write your code in notepad/textpad and test them in VS, it kind of defeat the original purpose.
There is a few tips, for the beginner like me.
Named your sitemap file "web.sitemap", and put it in the root directory of your project, otherwise you may have to go through complicated configuration process.
P.S. This is not a compulsory requirement, you can change the file name or directory, but you need to add site map provider in "web.config".
2 Choose your solution or project root directory carefully, because it is not easy to redefine it.
P.S. I spent a lot of time to move files around in Windows Explorer because I wanted to change my current solution directory to another folder.
These are the tips I find most useful. I would've saved at least 2 hours if I know these in the beginning.
Greetings,
I'm sorry if this question has been asked already. I've tried using the search function but couldn't find any answer that suited my situation.
I have a real simple C# form application of only 1 file, a exe.
I distributed this currently by 4shared where people can download it as pleased.
However, every time I make changes to the program people will have to download the new version from 4shared.
Now this isn't a ideal situation and I'm a noob when it comes to creating upgrade but the situation I wish is that the program looks at a website / ftp server where I deploy a new version.
I'm looking for a way inside my program to look at the file on that website / ftp server and decide wether there's a new version available.
If there is a new version available in the website / ftp server I would like for the program to update itself to the newest version.
Hope you guys can help me out with this and I hope I explained my situation enough !
NetSparkle is a nice alternative to click-once with more deployment options. http://netsparkle.codeplex.com/
Have a look at ClickOnce. It will do this for you.
When I'm developing and publishing such applications, I usually do it the following way:
Develop a .NET Windows Forms application
Develop a tiny ASP.NET application with an ASMX web service.
Publish the ASMX web service to my public web site.
Add a WSDL reference for the web service to my Windows Forms application.
Create a setup (I prefer Unicode NSIS over ClickOnce).
The logic I implement in the SOAP web service is basically a single function:
[WebMethod]
public string CheckUpdateAvailable( string currentVersion )
{
...
}
The Windows Forms application calls this method (e.g. from a background thread upon program start), passing its current assembly version as a string to the function.
The WSDL function in turn checks the passed version against the newest setup version (e.g. being stored inside web.config or extracted live from the setup.exe on the server). If a newer version exists, it return a string with the URL to download from; otherwise it returns NULL.
When the caller of the WSDL function gets a non-NULL string, it can show a message to the user, asking whether he wants to download and install the executable and then simply execute the URL (via Process.Start).
WyUpdate is the way to go here. We've been using it for over a year with great results (they have excellent support too).
It actually uses patches to update files so that when a 5MB executable only has a small change, the client only has to download a file in the order of kilobytes.
They supply an automatic update component for either Windows Forms or WPF that looks nice and works great.
You can host the update files on either an FTP server or a normal website without any server-side configuration.
There's plenty more to it, and the best place to start is with their video tutorial of how to set up an update.
Here's an open-source library I wrote to address specific needs we had for WinForms and WPF apps. The general idea is to have the greatest flexibility, at the lowest overhead possible. All you'll have to do is create an update feed and reference the library from your app.
So, integration is super-easy, and the library does pretty much everything for you, including synchronizing operations. It is also highly flexible, and lets you determine what tasks to execute and on what conditions - you set the rules (or use some that are there already). Last by not least is the support for any updates source (web, BitTorrent, etc) and any feed format - whatever is not implemented you can just write for yourself.
Cold updates (requiring an application restart) is also supported, and done automatically unless "hot-swap" is specified for the task.
This all boils down to one DLL, less than 70kb in size.
More details at http://www.code972.com/blog/2010/08/nappupdate-application-auto-update-framework-for-dotnet/
Code is at http://github.com/synhershko/NAppUpdate (Licensed under the Apache 2.0 license)
I plan on extending it more when I'll get some more time, but honestly you should be able to quickly enhance it yourself for whatever it currently doesn't support.