I know that C# applications will require the .Net framework to execute on any given machine. However, I am curious, in order for CodeDom to work properly must Visual Studio also be installed on the computer the application is being run? I only ask because doesn't CodeDom use a file that is part of the VS installation when producing files?
If you know of any other system requirements I would appreciate hearing about them.
No, using CodeDOM doesn't require Visual Studio to be installed. It works fine without it.
And compiling code by yourself doesn't require VS either. All you need is the C# compiler – csc.exe. And that is part of the .Net installation. When compiling source code to an assembly, CodeDOM actually invokes csc.exe.
Related
I tried to import a winform solution file from VS code (windows) to monodevelop (Linux) but it failed. The error is as follows:
Error while trying to load the project '/home/virtuall_kingg/Camera_GUI/Camera_GUI/Camera_GUI.csproj':
File not found: /home/virtuall_kingg/Camera_GUI/Camera_GUI/Camera_GUI.csproj
I added Camera_GUI.csprojfile also but still the error is same.
Can anybody guide me on how to import solution to mono?
This winform project has become pain in my neck.
Is building the GUI using gtk# in Ubuntu from scratch is the only way?
EDIT: Now you can substitute mono with .NET 5, the common .net framework for all platforms.
You are asking multiple questions here. In Linux you have (limited) support for WinForms through Mono. Depending on how complex is your project, you could port it without modification. If there are p/Invokes, then you won't for sure be able to port it.
Yep, in Linux the "other" big option is Gtk#, which has a long history. If you would want to port the project starting from scratch, it'd be a good option, but it'd involve porting your classes from working with WinForms to Gtk#, which is not impossible, but not trivial either. The feasibility of this would mainly depend on how good that project is architected. Do you have bussiness logic and views separated? If the answer is no, then the process will be tedious, and as hard as lengthy.
MonoDevelop is an IDE for C#, and Visual Studio for Mac is roughly MonoDevelop. It certainly works in Linux... as well as Visual Studio Code. So, there is no need to change anything in that front if you just need to port your code to Linux.
Okay, now, what's the road to follow? I think the best one is to try Mono with WinForms. It'd maybe involve simplify some code in the user interface part, but is certainly feasible. Just remember that you need to install Mono, and if your project is set to target .NET Core, then you need to create another project from scratch and set it to target .NET Framework.
Now, the specific question is that MonoDevelop complains about a missing Camera_GUI.csproj. This means that you've only picked a few files, but not the whole solution. Any IDE (Visual Studio, Visual Studio Code, Rider...), would complain about the same thing. Either remove the project from the solution, or add the project with all its files to the directory in which the solution sits.
So, the answer is: don't change anything if you don't need to retarget your project. Just move to a Linux box or virtual machine, with the whole project and open it in Visual Studio Code Rider, Rider, or MonoDevelop it does not matter. From within the IDE, remove those projects that make no sense in Linux (i.e., windows installer), and then recompile and start the program. Polish those parts of the user interface that need tweaking and that's it.
Should you need more help, please be more specific and provide more info.
I have a file called Asembly-CSharp.dll i want to edit in C#. I decompile it with .NET reflector's FileGenerator (also tried file disassembler and dotPeek) plugin, thus creating a visual studio project, i open it in visual studio, but it fails to build, i didn't change anything, yet i get lots of errors (like unexpected characters etc), the dll refers to lots of other dlls but even if i put all of them in one solution it fails. Why does it fail if i didn't change anything in the source code (.NET framewrok version is the same as it was before decompilation). Any help appreciated.
I tried both visual studio 2012 and 2013 (win7 but i know that shouldn't be the problem)
I'm not professional, forgive me if i made some silly mistake.
Reverse engineering needs a bit of effort. Nothing comes for free. You need to manually fix those errors.
Mostly these errors occur because either Reflector decompiles the code with compiler-generated variable names that are valid in IL but not in C#, or because that particular assembly was written in some other language that supports features that cannot be directly translated to C#.
I wrote a few VS Extensions and Roslyn seems to be an interesting tool in such endeavors. I would be really curious to try it.
But
Is there a safe way to install it? Can I install it in an isolated hive? How cleanly does it uninstall?
Correct me if I am wrong but the Roslyn compiler replaces the 'Standard' C# compiler. If it breaks the result will be quiet unpleasant
I think this thread should have answers to your questions. When you install the CTP it replaces the C# and VB language services under the 'Roslyn' rootsuffix inside Visual Studio. The 'Standard' C# and VB compilers (including the command line compilers vbc.exe and csc.exe) are not replaced and your regular code editing experience inside VS is left unchanged.
In other words, the intention is that the CTP shouldn't impact your existing setup - but to be sure you could follow Hank's suggestion and install it on a Virtual PC.
This thread also has some discussion around this.
Disclaimer: I work for Microsoft on the Roslyn team.
Yes, it's safe to install. I installed on VS 2012 and it was working fine, but it causes problem when used with Resharper. You can even uninstall it with Tools->Extensions and Updates.
I created a C# application that uses a C++ dll and im trying to create an install package that will allow this to run on other computers whether they have VS or not, the problem is i don't know what C++ libraries i need to let it do this. When i run just the application on a blank virtual machine it says
" xxxx has encountered a problem and needs to close."
If i go and download visual studio 2008 express version and install it on the machine, the my program will run fine. problem is express is 85-185mb to download and 335mb up to 1.1gb to install on a machine, the program that is using it is only 33kb. huge overhead there...
if i install just the C++ redistributable from msdn site, it takes up 4mb, but it wont let me run my program.
what packages from C++ do i need to make this program run on a blanked computer?
That question can be tough to answer. If you have the source of the c++ dll you should be able to see its dependencies unless the person used a lot of com or load library calls. One of the best tools I used to get c++ depencany info was depends.exe. One thing to check if its your code is that you are not using debug version with dependencies on debug dll that I think are not in the redistributable.
caleb, I recommend you a program called Dependency Walker. It will show you all the dll dependencies you have. I'm sure there are much more of them for Windows but that's the one I've been using for quite a while and I like it. So you did right by downloading the redistributable package from the MS web site but your app probably depends on some other libraries. When I tried to build my installer long time ago using Visual Studio I remember it was a way to include a redistributable package in your installer or use side-by-side installation - depending whether the license agreement of your Visual Studio version allowed you to do that or not. Also you could include all the dll dependencies you have in the installer.
Hope that helps
The C++ runtime dlls you need are the ones provided with the compiler as redistributable package and exactly this one! Other redist packages won't necessary work because of the manifests embedded in the executables which require an exact version (checked by a hash value of the binaries in the side by side assembly directory C:\Windows\SxS)
So you are right with the redistributable but you need the one that was installed with the compiler not one from a best guess from the internet. The exact versions can be looked at in the manifest files (XML)
My program is written in C# NET 2.0,it's using external functions from a dll written in C++ using Microsoft Visual Studio 2008 SP1.
If I remove the dll from the directory the program is placed,the program crashes at the moment it should use the dll.That's normal.
But the users that are using my program get the same error at the same place without moving the dll.They all have C++ Redistributable 2008 from >here<
Does it happen because I made the program in .NET 2.0 instead of NET 3.5 or it happens ,because the redistributable should be an older version?
Edit:Note for me,the program runs fine.
>>new thread<<
Its most likely the wrong runtime. Make sure you are distributing the correct one. These will always work on your dev box because the runtimes are in the path. For testing software, I use a windows xp virtual machine. I set up the virtual machine as a completely fresh install, install the components I know that I need (.NET framework, etc.), then run my installer. You will run into a surprising number of setup issues doing this.
The C++ Redistributable that you linked to looks like it is from the original release of Visual Studio 2008. If that changes with SP1, I could see that causing the crash. Maybe there is an updated version of the redistributable that your users need to install?
There's preciously little information in your question about the actual crash which could mean any of many things. In my experience with mixing .NET and native C++, many issues can occur in the side-by-side (SxS), especially if the DLL and the .NET application were built with different versions of the compiler.
You probably need to reproduce this problem on a local machine to debug it.
Dependency Walker can be excellent for tracking down these sorts of problems. You can load a DLL into it and it will tell you if any of its dependencies are unavailable. Sometimes missing DLLs are not necessarily a problem (if you do not go down that code path), but it is so much better than guessing.
No difference in this context of using .NET 2.0 or 3.5.
Look in method where you link and export functions from C++ (if it unmanaged)
If external functions had written on managed C++, look into signing and version of dll's