I have a click once deployment project that has been working fine for a long time now. I added some new dll's to a project that is referenced by it. The dll's can't be referenced in references, so I added them as files to the project.
Build Action is Content, copy to output directory is copy always.
when I build the application, the dll's appear in the bin\debug directory. The program uses them just fine too on my computer. When I deploy the application, the dll's don't make it to the other computer.
Under Publish in application properties I went to application files. the dll's I need are not listed there to be included in the deployment.
I would love some help, I feel like I'm missing something really simple.
I have a feeling if I put the dll's in the main project, it would work. I don't really want to do this, I would like to keep them all located in the project they are actually used in.
When I deploy the application, the dll's don't make it to the other computer.
...
Under Publish in application properties I went to application files. the dll's I need are not listed there to be included in the deployment.
You need to set them to download with the application. Click the DLL in the project properties, then press F4. Set the Build Action to Content, and the Copy to Output Directory to something like 'Copy if newer'
For information - it is likely if you download the DLLs for referencing by a built exe (for example) you may need to configure a manifest file for the executable as well to get it to pick up the DLLS correctly
Related
I have a project that I wish to publish. currently, I hardcode some reference files (.json,txt, and .ico) to be used in my project, which reside in a folder on my desktop for testing purposes. now that I feel I'm close to a version 1.0 release I want to migrate my resources to a applications folder upon install. basically want to create these files when the app is installed.
2 big questions I have is how to reference to the application folder that doesn't exist yet, and how do I publish the setup project.
I have the setup project installed for VS2019, and followed a quick and brief blog on how to use it. but I haven't found out how to publish that setup project. I can publish my project with my actual code in it, but I cannot publish the setup project.
below is a screenshot of the setup project. and i will add screenshot of my settings for the reference file.
Add the files into subfolder of your project and in the options part in Visual studio set that files will be copied to "debug"/"release" folder.
You will have an output folder with all what you needs and can be shippable.
I have a WPF app that works with local SQLite and Entity Framework Core. I want to distribute my app using ClickOnce.
Everything works fine when I run it using Visual Studio 2017. But app had a crash on a start when I used ClickOnce. The crash was so early so I couldn't even log the exception. After some time I found that in publish folder some dlls were missed. For example System.Runtime. All references are NuGet packages. Then I found that despite of I have a reference to the dlls in my project ClickOnce application files list doesn't contains it.
The only solution I have found for now is to add missed dlls as files in root of my project and set build action to Content. In ClickOnce application file dialog I set publish status to Include.
It works now but it looks like not the best way to do it. The question is why they are missed in the first place. More likely I missed something or I am not understand the root of the problem.
UPD:
You can find an example code here.
It works from Visual Studio but crashes on a start when you try to install it as ClickOnce application.
UPD: The problem was fixed in Visual Studio Professional version 15.6.1
There are two ways solving solve this.
At first, you have to go Properties → Publish → Application Files, and at this place, make your DLL files include in your project
But if it does not work, go to References and make the DLL file CopyLocal = False. You add a DLL file like Existing Item in your project and make them Copy Always.
It will work correctly.
But for your sample I watch this and I solved it. Look at this image:
You have four DLL files. You need do this for them:
System.Diagnostics.Tracing.dll
System.Reflection.dll
System.Runtime.dll
System.Runtime.Extensions.dll
At first go to your reference and make them Copy Local False:
Then go to the path of each DLL file and add them like Existing Item, and then make all of them Copy To Output Directory CopyAlways
Then Publish it and run it like in this picture. I run it from publish file and it works.
Even if you set the dll to copy local, the dll will not get copied over unless you actually use the dll in your code. You might try adding System.Runtime in your code somewhere like this maybe?
var dummytest = System.Runtime.GCSettings.IsServerGC;
Based on Issue 9 on https://blogs.msdn.microsoft.com/bclteam/p/asynctargetingpackkb/ I was able to do the following:
Symptom
ClickOnce applications targeting .NET Framework 4.0 that reference the Microsoft.Bcl or Microsoft.Bcl.Async packages may experience a TypeLoadException or other errors after being installed.
Resolution
This occurs because ClickOnce fails to deploy certain required assemblies. As a workaround, do the following:
Right-click on the project and choose Add Existing Item
Browse to the folder where the System.Runtime.dll lives
In the File name text box paste in the path of the file
Click the down-arrow next to the Add button and choose Add as Link
In Solution Explorer, holding CTRL select System.Runtime.dll
Right-click the selection, choose Properties and change Copy to Output Directory to Copy always
Republish
I've been creating winforms application for a while now, but i've never really published one to other people before.
Recently I started doing this but every time I publish my build, the user requires to de-install his current installation and install the new one.
Is there any way to remove this, so I'll only have to send a .exe file which they can use without any form of installing?
I've attempted to send the .exe file in the bin/debug/ but this only seems to work on computers where Visual Studio is installed.
Go to your solution and set the CopyLocal to true for all projects, this will ensure that the ..\Bin folder contains all the necessary assemblies for your program. Then just zip up the ..\Bin folder, get it onto the client machine, and then unzip it.
Hope this helps!
1) Change from Debug to Release in Solution Configurations
2) Right click on your project and click rebuild
3) Go to your bin=>Release=> app.publish for your exe version
4) Copy over any required .dll files,any .config files and any other resource/image files you need from bin=>Release to bin=>Release=> app.publish.
Your app.publish folder should now contain all the files required to run your form, and can be copied or zipped up and send to anyone who needs to use it !
You can try using ClickOnce as an installation method. It even has a built-in auto-update, so you can publish your application to a web server, and all existing installations will download latests version automatically.
To configure ClickOnce go to corresponding tab in your project settings.
I finished a project.I am trying create a setup .
My Problem is that :after I create setup project dll files that I used in project added to same folder with my .exe file like
ApplicationFolder(Folder)
Devexpress.Data.dll
Devexpress.Util..dll
.
.
project.exe
but I want to get it different folder.
like
ApplicationFolder(Folder)
MYDLLFILES(Folder)
project.exe(exe file)
how can I make this? Thanks a lot
This is not only a problem of setup. unless you are already handling this in the app.config and/or with appdomain.assemblyresolve event your application will not work at all on the user's machines once those required references will not be available in the same folder if the .exe file.
Surely you could isolate every single file and tell the setup project where to put it but your program has to be modifief to then look for those files in those other locations.
I accidentally faced this problem today, I want to add some separate dll files into the setup package (I have to do this because I can't add reference of these dll files into my C# program , these dll files are of 3rd-party software).
I did as following:
Right click on Setup Project > Add > Assembly and then browse to dll which I need, then press OK button.
These dll files will be included into Setup project, and will be packaged into setup file also.
Hth.
The problem is that Visual Studio setup projects will automatically include referenced DLLs for you so you won't be able to customize their location with these setup projects.
See also the following articles by DevExpress:
How to deploy WinForms applications on client machines
How to distribute applications which use Developer Express .NET Windows Forms controls
The second article explains how to register DLLs copied to a different location.
By the way we're also also deploying a big app using these VS setup projects and our base installation folder is full of DevExpress and other DLLs. I agree that it looks totally ugly and I'd also prefer a clean structure with a lib subfolder, but nobody cares about that. Customers don't start our application from the installation folder, they use the shortcuts.
My problem is that DLLs needed by my ClickOnce app are cluttering my project folder and I would like to move them to a bin folder but don't know a simple way to do so and still get the files to distribute.
To explain:
I'm distributing a C# app with ClickOnce. It has the following components:
One C# application
One CLR DLL
Umpteen C++ DLLs
All of these build to a tidy little bin folder.
Now the CLR DLL is referenced from the C# project, so it copies and deploys fine.
But I also want to distribute the C++ DLLs as part of the ClickOnce project, so I've done the thing that people say to do, which is add them to the C# project (drag ... drop), and in Properties, set Build Action to Content and Copy to Output Directory to Copy if Newer.
ClickOnce seems to deploy these files quite nicely.
The problem, though, is that now I have a bunch of binaries dumped into my C# project folder (and appearing in the project root in the IDE), which mixes executable files with source files in a way that is extremely obnoxious.
Can anyone clue me in to a simple way to keep all my DLLs in the output folder where they belong, and also have them distributed by ClickOnce?
Move you C++ DLLs somewhere sensible then when you add them to the project choose to add them as a Link instead of the standard Add which copies the files to the project folder.
To do this follow these steps:
Right click the project file and choose add existing file.
Navigate to the location of the file(s).
Click the down arrow next to the Add button and select Add as Link