I have a Command line console app that references a dll 'VMware.Vim.dll', but this has other referenced dll's like VimService41.dll, VimService20.dll etc saved off in the GAC on my local machine.
I want to deploy this exe to any computer and be able to run it by passing arguments. When I copy over the exe and VMware.Vim.dll, it complains about the other missing dll's although they are not part of the release folder.
I tried the Publish option and created a ClickOnce Application to deploy it to the machine I want to execute the exe from. This created a setup.exe and a manifest file. When I run it, it complains that the external dlls have not been added to the GAC.
How do I run this clickonce console app by passing arguments?
First, you don't run a ClickOnce application by running the EXE. If you're going to do that, just xcopy the bin folder from your build over to the machine. You're wasting your life using ClickOnce if you don't need to do automatic updates.
Second, you can try tracking down all of the dll's that you need and including them in the project. This includes all of the secondary or tertiary dependencies. Add them to your project, set the build action to "content", and set "copy to output directory" to "copy always". Then they will be included in the output directory when you build.
Some applications' dll's will work when deployed locally (like DirectX) and some won't (SQLServer Express). You'll just have to try it and see if these do.
I would say, however, that using VMWare assemblies probably is against the EULA. That's like trying to include Office assemblies in order to run Excel on a machine w/o it installed.
As for passing arguments, if you really DO want to use it as a ClickOnce application, here is a blog entry explaining how to pass arguments to an offline (or online) ClickOnce application:
http://robindotnet.wordpress.com/2010/03/21/how-to-pass-arguments-to-an-offline-clickonce-application/
I don't think this scenario is an appropriate for click once. If you need to install things which modifying the gac is then you need to use an installer.
If you can find all the dependencies you can include them (by setting them to copy local in VS) with the release and then you shouldn't have a problem.
If you want to use ClickOnce, what you need is to add a custom pre-requisite so that the application installs it's dependencies in the GAC.
Look at: http://msdn.microsoft.com/en-us/library/ms165429(v=VS.100).aspx
Related
I have an ASP.NET Core MVC application that is located in App folder. And I'm not using Kestrel or IIS Express to run it. Rather we have an infrastructure that hosts that App folder directly in IIS and does more things to make our development environment very similar to our production environment (DevOps).
Things work just fine. When I build, the output goes into bin\Debug\netcoreapp2.0 folder and we have a Web.config file in which we have configured our AspNetCoreModule to load the entry DLL from that path.
Now I want to use ClosedXML, which has a dependency upon System.Drawing.Common library.
When I build and test my application, I have this error:
An assembly specified in the application dependencies manifest
(App.deps.json) was not found:
package: 'System.Drawing.Common', version: '4.5.0-preview1-25914-04'
path: 'runtimes/win/lib/netcoreapp2.0/System.Drawing.Common.dll'
The point is, I have a bin\Debug\netcoreapp2.0 folder that hosts the application, and I can confirm that System.Drawing.Common is already copied there. Yet seems that MSBuild doesn't copy it to the intended bin\Debug\netcoreapp2.0\runtimes\win\lib\netcoreapp2.0 folder.
I can copy the requested library to the given folder, that is runtime/win/lib/netcoreapp2.0, and the app will work just fine.
I can add additional probing paths to my App.runtimeconfig.json.
I can change the searching path for this library in my App.deps.json to the same directory.
But these are all done manually.
How can I make the build process copy the dependencies to their correct locations?
You can use the Publish command to create your output directory. Either using dotnet publish from the command line, or in Visual Studio's Solution Explorer, right click your project -> Publish.
When you just Build your app, the dependent assemblies that come from NuGet packages stay in the NuGet cache folder. And when you F5/dotnet run your app they are loaded from the NuGet cache folder. But if you want your application folder to be ready to run in a different environment outside of VS/dotnet run, then you should be publishing your app.
Is it possible to publish a visual studio c# project with ClickOnce, in just one .exe?
I could not find a way to do it. My project has additional files it uses
like: it calls external exe, it links to dlls, etc. And all these files I want
to somehow embed in on .exe, rather than have an exe + additional files next to it.
Edit: the image explains even better what I need.
Yes, you can add external dlls, resources, exe, and so on in your ClickOnce setup. Look at these photos. Sorry for the language.
If you want to publish it on IIS, you will need a host. Those files (application files,setup.exe and so on) will be stored in IIS. You only need to provide a 'publish.htm' or 'setup.exe' to users. 'publish.htm'/'setup.exe' will connect to your IIS. And if you use ClickOnce, your application will be updated more easily.
Otherwise, you just need VSInstaller in VS2010 or InstallShield Limited Edition in VS2012/2013. It will produce one .exe file.
You can add external exe in your installation. In your Setup and Deployment wizard Select the Application Folder and choose Add File then select your exe.
For prerequisites read this article.
I wrote a fairly simple application with C#/.NET and can't figure out a good way to publish it. It's a sort of a "tool" that users would only run once, or run every few months. Because of this, I'm hoping that there is a way I could deploy it where it wouldn't need installing to run (it could just be run by double-clicking an EXE file straight after downloading).
However, it still needs (somehow) to include the correct version of .NET, libraries, etc. so it will run correctly. I know this is included when using ClickOnce, but that still installs the application onto the user's computer.
Is there a way this can be done?
EDIT - \bin\Debug
myAppName.application
myAppName.exe
myAppName.exe.config
myAppName.exe.manifest
myAppName.pdb
myAppName.vshost.application
myAppName.vshost.exe
myAppName.vshost.exe.config
myAppName.vshost.exe.manifest
extraLibrary.dll
as well as two folders
app.publish
Resources
It is possible and is deceptively easy:
"Publish" the application (to, say, some folder on drive C), either from menu Build or from the project's properties → Publish. This will create an installer for a ClickOnce application.
But instead of using the produced installer, find the produced files (the EXE file and the .config, .manifest, and .application files, along with any DLL files, etc.) - they are all in the same folder and typically in the bin\Debug folder below the project file (.csproj).
Zip that folder (leave out any *.vhost.* files and the app.publish folder (they are not needed), and the .pdb files unless you foresee debugging directly on your user's system (for example, by remote control)), and provide it to the users.
An added advantage is that, as a ClickOnce application, it does not require administrative privileges to run (if your application follows the normal guidelines for which folders to use for application data, etc.).
As for .NET, you can check for the minimum required version of .NET being installed (or at all) in the application (most users will already have it installed) and present a dialog with a link to the download page on the Microsoft website (or point to one of your pages that could redirect to the Microsoft page - this makes it more robust if the Microsoft URL change). As it is a small utility, you could target .NET 2.0 to reduce a user's probability to install .NET.
It works. We use this method during development and test to avoid constantly uninstalling and installing the application and still being quite close to how the final application will run.
First, you need to publish the file by:
BUILD -> PUBLISH or by right clicking project on Solution Explorer -> properties -> publish or select project in Solution Explorer and press Alt + Enter
NOTE: if you are using Visual Studio 2013 then in properties you have to go to BUILD and then you have to disable define DEBUG constant and define TRACE constant and you are ready to go.
Save your file to a particular folder.
Find the produced files (the EXE file and the .config, .manifest, and .application files, along with any DLL files, etc.) - they are all in the same folder and type in the bin\Debug folder below the project file (.csproj).
In Visual Studio they are in the Application Files folder and inside that, you just need the .exe and dll files.
(You have to delete ClickOnce and other files and then make this folder a zip file and distribute it.)
NOTE: The ClickOnce application does install the project to the system, but it has one advantage. You DO NOT require administrative privileges here to run (if your application follows the normal guidelines for which folders to use for application data, etc.).
I'm a web developer building my first production grade console application (C# .NET 4.0). I have a question about creating a settings file that the user can edit before running the console app (to customize output folder paths, etc).
I'm a little confused -- when I publish my console application and install it (by clicking on on the generated setup.exe file in my target publish folder), all I get is an entry to my start menu. Nothing gets installed to C:\Windows\Programs, and there doesn't seem to be anywhere else on my system that files get installed to. Essentially, I'm just trying to find the app.config xml file so that I can edit it after the program has been installed. (btw, when I click on the start menu entry, the program executes properly).
Is what I'm trying to do possible?
For a clickonce deployment, the files will be installed under the profile of the user who installed the application (by default).
For windows XP this should be:
C:\Documents and Settings\username\LocalSettings\Apps...
For Windows 7 (and Vista?) this should be:
C:\users\username\AppData\Local\Apps...
An installation program for your software is a separate piece of software.
You can definitely make one but when you compile your console app it doesn't create an installation executable. It just makes it's own executable. You can copy that executable alone and run it. If you need more resources to go along with it and therefore decide you want an installation program, you have lots of options.
The two that spring to mind in this case though, are setting your project to use "ClickOnce" from the project properties, or adding a "Setup and Deployment" project to your solution from the "Other project types" section of the add project dialog box.
How can I deploy a C# Visual Studio 2005 project so that I can run the application in another system? My project has a few dependencies and files that have to be integrated while deploying the project.
What is the best way to handle this?
You need to know what dependencies you have.
you need to have .Net framework installed
you have to explicitly install all dependencies that you used from the GAC on your target machine (some 3rd party components)
and then you just need to copy files from your \bin\Release folder
install all services, etc. if you have any
In the simplest cases only copying files should be enough.
Have you looked into ClickOnce deployment?
It's far from perfect, but for projects without a huge amount of overhead, it's generally good enough.
What kind of project?
Assuming it's a regular winforms application, just copy everything from either the obj\debug or obj\release directory to the new computer. Then run your executable
You can right click on the project file in visual studio and publish to a different location. This will build the site and copy it to the specified directory.
Also, if you need to do anything extra during the build, you can specify custom build actions on the build tab of the project's properties.
EDIT: now that I see you added that it's a windows application my answer doesn't matter. I'd try adding a setup and deployment project in visual studio to handle installing/deploying your windows application.
You more or less have three options (maybe 4?) as I see it.
Windows Installer
ClickOnce
Just distribute
the exe itself
In your particular case I would suggest ClickOnce as long as the project is not massive with too many dependencies.
For other alternatives.
The right answer depends on many criteria.
The simplest way to deploy is by copying files. Just put your .exe, the dependent .dll's, and the .config file in a directory and copy it onto the target machine. It's simple, but there are many restrictions to this approach:
It assumes that the target machine has the right version of the .NET framework installed
It assumes a certain technical competence on the part of the person installing the software.
The installation won't do basic things like create start menu items.
Publishing the program for ClickOnce deployment addresses a lot of these issues, but it's got its own set of limitations. I haven't used it much, so there are probably more than these, though these alone are pretty significant:
Programs are installed into the ClickOnce cache, not the Program Files directory.
If your program does anything outside of the ClickOnce sandbox, you have to deal with security elevation and code signing.
You can create a VS Setup and Deployment project and build an .msi file to install the program. The most obvious drawback to this is that it's complicated: .msi files can do many, many things, and the Setup and Deployment object model is complex, with documentation that is, let us say, fanciful. But there are things you can do with .msi installation that you can't readily do with other approaches, including (and certainly not limited to):
Cleanly uninstall the program through Add/Remove Programs.
Provide an actual UI for installation that lets the user decide where to put the program.
Support scripted installation via MSIEXEC.
Install components besides the program, e.g. databases, COM objects, etc.
Put components in the target machine's GAC.