File not found: project.exe - c#

I have a project in Visual Studio 2010 that requires me to run it as an administrator. I have added the app.manifest file to the project and made the appropriate modifications there. I'm currently running this project under debug configuration. Unfortunately, when I open VS 2010 as an administrator and try to build the project, among other things it complains that it can't find the .exe file for the project (but the .exe file actually exists!).
Furthermore if I run this project as a non-administrator I'm able to build the project. Why is VS claiming that the .exe file does not exist?

Try deleting the files in
"your_solution_folder"\bin\debug
and
"your_solution_folder"\obj\debug

Try deleting .suo, clean and rebuild solution.

I was using the subst command to create a virtual drive that was the drive for the project. I had to run the command prompt as an administrator and execute the subst command and when I ran VS as an administrator after doing that everything built.

Related

How To Create An Executable from Visual Studio Project

So currently I have a project in Visual Studio that runs perfectly. When I build the project and create the .exe build in my Debug folder I can run it without any problems. However, when I try to share my .exe build with other co-workers the project doesn't run and crashes. At first the project described that the dependencies weren't able to be located. I then added the dependencies to the folder where the .exe program was located and it still doesn't work.
So what is the best way to create a .exe program that I can hand out to people? And is there a way to test the program in an "outside" environment on my computer? Is there a way to create a .exe program that's not located in my debug folder?
Give them the whole debug folder with the exe. It should work. To have less files and optimization from the compiler use release instead of debug mode. Give them the release folder in this case.
If you want even less files install the nuget package fody costura which will pack all .dll into the exe
If you want to create an installer, check out click once deployment.

How to make a portable program in C# Visual Studio 2015?

Portable means the program runs immediately and doesn't ask to be added in "Programs and Features" of Windows.
I only know in Visual Studio C# 2015 to press Build->Publish, and publish the program to a setup.exe file with a folder near, and when I run setup.exe it adds itself to Programs and Features...
The program is a Windows Forms Application program.
Change the build configuration to: Release
Build the solution.
Zip the files in the bin\Release folder.
Unzip on another PC.
Run the exe file.
It should work too if you just give the .exe file from the release folder to the user.

Do we need to add the files in the debug/release folder to create a setup in Visual Studio?

I have created a setup file for my Winform project in Visual Studio 2013 but it won't run after the installation. When I use debug or release mode in Visual Studio, it will run.
A closer investigation, I found out that there's lot's of .dll, .config, .cs, .bin, .manifest in the debug folder as well as the release folder. I think they are the files created when I run debug mode or release mode.
Do I need to include all these files from the debug/release folder to the setup file system when I create my setup? Any idea how to check why my app won't run?
The files in the Debug folder must not be distributed, it is against the terms of you EULA for Visual Studio.
You need the release files and unless you are running on the build machine you may need some extra dependencies, You will be told about these in the error messages that are displayed.
More than that I can't help you with, because you haven't said what the error is, unless its no error in which case check your shortcut.
If the Application runs fine in the Debugging Mode of visual studio, then it means that you are not creating the setup file properly. You have to manually add all files that appears in the
../bin/Debug
folder of your project to after adding the primary output.

Creating a dll from classes in c#

I have a few classes with the same namespace, and I want to put all of them in a dll file, and use it in other places.
I read the guide on Microsoft's website:
http://msdn.microsoft.com/en-us/library/3707x96z(v=vs.80).aspx
They suggested this:
To build the file [myDllName].DLL, compile the two files [myClass1].cs and
[myClass2].cs using the following command line:
csc /target:library /out:[myDllName].DLL [myClass1].cs [myClass2].cs
I wrote it in a cmd window and got an error that there is no such command as csc.
Plus, how it will find my files without a path?
So what is the right way of doing it? Where should I write it?
I saw some posts here with Library classes.. but not sure how it can help me.
My classes are in a different solution, and I just want to use it as an external dll, and not within the same solution.
In this case, Microsoft's guide seems perfect, if it will work.
If you use the Visual Studio Command Prompt window, all the necessary environment variables are set for you. In Windows 7, you can access that window from the Start menu by opening the Microsoft Visual Studio Version\Visual Studio Tools folder. In Windows 8, the Visual Studio Command Prompt is called the Developer Command Prompt for VS2012, and you can find it by searching from the Start screen.
source
You can run the vsvars batch file from a command prompt and it will set paths for you, for that instance of cmd.exe
Mine is here:
>"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\vsvars32.bat"
Why don't you just create a separate 'Class Library' project in your solution in Visual Studio?
You can than easily add it as a project reference to all other projects that need it.
You can create Solution Folders in VS to logically group projects.
Make sure csc.exe is in your PATH environment variable.
You should have a vsvars32.bat that was installed with Visual Studio. You can run that to automatically add it to the path, or dig down in regedit to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
Look through the subtrees in there for your framework version, and for an InstallPath key. That should tell you what directory to look in.
You can then use that, and:
WHERE /r "the_directory_you_found" csc.exe
to find the path. Add that to your system environment variables, and you should be able to find it.
As for the path of the class files, either run the command from the directory they're in, or specify the path when specifying the class files.
If you have Visual Studio installed, you could try creating a 'Class Library' project; Or you can run csc.exe by Launching "Visual Studio Command Prompt".
If you don't have Visual Studio installed but have .net framework installed. You can run csc.exe from the framework installation directory.
Installation directory path for .net Framework 4.0 :
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319

.exe file of program

I have completed my program and would like to send that program in its compiled state to other pc's.
I understand that in the Debug folder there is the programName.exe file, which when I open it on the PC I created it with - it opens.
But if I send that .exe file to other pc's, it crashes or simply doesnt run!
Is there a way for others to see and use my program without installing visual studio?
I have asked this question before on another programming website with not much help, this is the link that they showed me, which i then followed:
http://www.dreamincode.net/forums/topic/58021-deploying-a-c%23-application-visual-studio-setup-project/#-application-visual-studio-setup-project/
The installer installs the program, but there is no files with it to open!
Other machines won't need to have Visual Studio installed - but they will need the appropriate version of .NET, depending on what you built against. If you target the "client" profile, the .NET distribution is fairly small.
You could build a setup project which kicks off the .NET framework installation if necessary, but it's likely to be quite a lot of work - in many cases it's probably simpler just to tell people what they need to install first, particularly if this is for personal use or friends/family.
There are most likely other DLLs that your project is dependent on that do not get copied over when only transporting that .exe file. You COULD just copy those over as well.
However, the best practice is to add a new Project under Setup for a Installer. It should detect those dependencies. Then the other users will just have to run the setup.exe that gets created (but you have to include the other folders and files that get generated). Open up the File System Editor tab of the Installer project. Then inside the Application Folder, I right click on "Primary output from [Main Project] (Active)", then select "Create Shortcut to ..." and drop the Shortcut into the Program Files and User Desktop folders on the left.
For something simple, the other DLLs should be fine.
Create the MSI Installer project for your application.
Copy your project output as input of MSI Installer.
.Exe is depends on .msi file, so when you click the .exe must verify the msi file existed in same directory.
Verify the .Net framework and Installation 3.0 before run the .exe or .Msi file.
The easiest approach would be:
1: Right click on your Solution Explorer and add a new project. The new project would be a Setup project, which would be under Other Projects -> Setup and Deployment -> Visual Studio installer and then choose Setup Project from the right side.
2: Add all your bin folder files to Application folder and then build your solution.
3: It will create a file with .msi extension. You can distribute that to anyone you want and they wouldn't need any VS.

Categories