C# WPF Program Relase not working on other computers - c#

This may be a noobish question, but suppose I have a genereated exe from a program I ran in release mode on VS 2015, if I want to send my program to another computer, of course I send the Release folder (that has all of the appropriate DLLs + the main exe).. But does the user on the other computer have to have Visual Studios 2015 run my exe? If so, should I just make it so my program is actually installed on the other computer? It seems that when I send my exe to a computer that only has VS 2012 it doesn't want to run, but when I sent my exe to a computer with VS 2015 it will run.. Is this just coincidence perhaps?

If you've generated the .exe in VS 2015, it has probably compiled using .NET 4.5.1 or above. This will not be the case for VS 2012. You need to either: compile your program against an earlier version of the .NET framework, which you can do in the project's properties. Or, find out what version of the .NET framework you need, and make sure the client system has that .NET framework installed.

No, you don't need to have VS instaled on client computer, neither 2012 nor 2015. All you need to ensure is that the computer have the same NET framework as your project has. For instance, if you project use Framework 4.0, you sen the release folder content and if that computer has the framework installed it should work. You must also check App.Config for your connection string if you are using a database.

Related

Visual Studio target framework not changing to 4.0

I am writing a Windows Forms program which doesn’t use any new tech from .net framework 4.5-4.7, but unfortunately I started the project with .net Framework set to 4.6.2. (Because in the beginning the company told me they only want to use it on win 7/8.1/10, later they changed their mind)
I know Windows XP is obsolete, but I have to run this program on a XP machine as well.
I already tried to set the targeting framework to .NET 4.0, but when I try on the XP machine with a .msi installer, it throws an error, that I cannot run a .net 4.6.2 dependent program, even before it starts the install process.
Can I “convert” the whole project to .net 4.0, or I have to copy all buttons, textboxes, couple thousands lines of code, etc. to a new project which only uses .net 4.0?
I’m using Visual Studio 2017.
Looking at the log you shared I can see DIRCA_CheckFX so I'm guessing the setup project is a vdproj which has been deprecated in favour of a framework like WiX.
The CheckFX step is a launch condition which you should be able to delete/manipulate, by opening the project and finding the launch conditions:
View -> Editor -> Launch conditions

Visual Studio Code on Linux - How to run a C# application when "app.js does not exist", nor should it

I am running VS Code on Ubuntu 14.04. I am trying to run a C# web application which my team can run just fine in Visual Studio on Windows. The problem is that Code gives me an error message, "/app.js does not exist". No such file exists in our project, and I think I want to run it using "Startup.cs" instead, but despite trying to change the 'launch.json' file accordingly, another file that my team does not have, I still cannot get my project to run. Has anyone experienced a similar problem?
The .NET environment for Linux is currently in a pretty early state. Thus you can't do everything on Linux that you can enjoy on Windows.
If you want to develop an ASP.NET application then you should read this guide on how to setup the environment to work with Visual Studio Code.
If you have a C# application that can already be compiled and run on Linux then you can
create a script file which compiles the project and runs it afterwards
and let this script be executed as the build task in Visual Studio Code. Here is how to do it: How to prepare/configure development environment for C++ projects in Visual Code Editor?
Just for your interest: You can't currently debug C# projects in Visual Studio Code.
Perhaps you can try to open the project with Monodevelop? This is an open source IDE for C# that runs on linux. It is compatible with VS projects.
You will probably need to also install Mono (the open source .net runtime) to run Monodevelop.
You may even be able to run your web app with the Mono runtime, although it has been always a bit behind the official Microsoft .net runtime (you may get 'class not found' exceptions if your code uses libraries that are not yet implemented in the Mono runtime).

how to run visual studio project in other computer which does not have visual studio installed in it

i have made a visual studio project which is quite small. i want that it should be deployed in the customer's PC so i want to make a exe file of that. so that it should be installed and used correctly. how can i make an .exe or .msi file. i have just heard it some where i dont know how to. because i am a newbie i dont know much about visual studio i thougt it will help me to make exe file but after production i got i cant deploy my project as i have .cs files of forms. i am using visual studio 2010 ultimate and building project on c# language can i make .msi or .exe file so that it can be run in other computer also? and if yess then whats procedure
When you compile your project, you will find .exe and (probably) .dll files in bin\Debug and bin\Release.
You can copy those files to a different computer and run the program, as long as it has the correct version of the .Net framework installed.
Install database on client computer.
Install your project on computer.
Make ODBC on computer.
a. make DNS with sql server.
b. make microsoft access driver.

Visual Studio 2008 compilation works; Same project compiled in 2010 doesn't

Have a project that was created in Visual Studio 2008 and deployed to a 64-bit Windows 2003 server. This application references a 32-bit Interop.ActiveDs.dll. The applications were originally compiled for 'Any CPU', however, explicitly compiling as 'x86' doesn't solve the problem. The project targets the 3.5 framework.
The server is running IIS 6.0 in 64-bit mode. When we deploy the version compiled in Visual Studio 2008, the app runs perfectly fine; all pages show up. In retrospect, this is actually surprising.
We migrated the application to Visual Studio 2010 (we did not change the targeted framework) and redeployed. Now we get a BadImageFormatException loading Interop.ActiveDs.dll. Which actually makes more sense than the 2008 version running.
To solve the problem, we set Enable32bitAppOnWin64 to true and ran aspnet_regiis.exe -i from the 32-bit folder of the 2.0 framework (as per various instructions on the web). In IIS, web service extensions, there were two versions of ASP.NET 2.0, one for 32-bit and one for 64-bit. We prohibited the 64-bit version, restarted IIS, and launched the website.
What we expected: The app to run as 32-bit, load the interop, and display
What we got: "Service Unavailable"
All other web pages that were previously working displayed the same message, as did the Visual Studio 2008 version.
The support page here describes the problem exactly, but tells us to do exactly what we did to resolve the problem (enable 32-bit mode).
We've rolled back to 64-bit mode in IIS and deployed the Visual Studio 2008 version for now, but we really need to figure out how to make this app run and load the interop (there are also 32-bit Oracle DLLs that are referenced)
Two questions:
Why does the Visual Studio 2008 version work at all??
How do we get the Visual Studio 2010 version to work? And what is 2010 doing differently that causes the issue?
Thanks in advance!
James
This can happen if you have one DLL compiled for 64-bit and another in 32-bit. Check through all of your references and look for those that do not have 64-bit versions. If you can't find 64-bit versions of your incompatible DLLs, you will need to compile in 32-bit mode.

Using visual studio for developing mono applications

How do I use Visual Studio to develop applications on Mono? Is this possible?
You just build the applications in Visual Studio, and run them under Mono instead of under .NET. The binaries should be compatible... but you'll need to make sure you don't use any libraries which aren't available in Mono - see the Mono Application Compatibility Guidelines.
(According to that page, you need to turn off incremental builds in Visual Studio though - a point I wasn't aware of before :)
See this article on how to run your apps while targeting the mono framework from VS.
Miguel has posted this entry a while ago, so it's quite dated. You can also try this and this (all hail Web Archive!)
Since version 2.0 MonoDevelop supports VisualStudio project/solutions file format. This means that you can use the same code base on Windows with VS and .Net and on Linux with MonoDevelop and Mono. That in my opinion is the best way to go about it. There are no major reasons to run application in Mono on Windows, other than for testing purposes and for that I'd rather set up a virtual machine to test the software in native environment.
I've posted an article on how to integrate Mono 2.8 (the build for .Net 4.0) into Visual Studio 2010 here - there's a link there to another profile built for Mono 2.4 (.Net 3.5) if that's what you're aiming for.
You can integrate the new Mono 2.8 profile with 3 simple steps:
Download the profile itself from here.
Unzip the contents of the profile Zip to one of the following directories:
32-bit systems: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
64-bit systems: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
The "Mono" folder in the ZIP should be directly under the "Profile" directory.
Restart Visual Studio if it had been running, open the properties of the project you want to use with Mono, and select the Mono Profile for 2.8:
Note: You will not be able to select the Mono Profile straight from the New Project dialog box; for some reason, that list of profiles doesn't match. Create your project as a .Net Framework 4.0 project first, and after creation set the project properties to Mono.
If you've upgraded your MonoDevelop install to the latest version (as of today, anyway), this Visual Studio solution & Project file will open with no problem - no changes required at all.
If you encounter the problem that you need .NETFramework,Version=v4.0,Profile=Mono in order to run the application, the trick was to create registry key.
For running Windows 7 x64, it was: HKEY\_LOCAL\_MACHINESOFTWAREWow6432NodeMicrosoft .NETFrameworkv4.0.30319SKUs .NETFramework,Version=v4.0,Profile=Mono
I suppose for x86 it’s HKEY\_LOCAL\_MACHINESOFTWAREMicrosoft.NETFramework v4.0.30319SKUs.NETFramework,Version=v4.0,Profile=Mono
(Where v4.0.30319 would be the version of the current 4.0 framework installed.)
Yes, you can develop on Visual Studio and target Mono (Mono for x86).
Here is an answer I made on all the available possible alternative to compile against Mono on Windows. However, it's focused for Mono x86.
As a summary, let's list the possible choice for VS development:
MonoHelper addin
Mono Profile
For Android/Ios, you can also cross-compile and debug inside Visual Studio with Xamarin addin. Although it's not free for commercial huge applications, there a free version available to make small ones.
Note: For those who wonder why in the world I would like to develop in Visual Studio on Windows, instead of MonoDevelop on Unix, let say that developer experience in MonoDevelop does not compare to VS one (especially when it comes to debugger/refactoring, the last due more to Resharper than to VS itself).

Categories