Replace matching files with local copies VS2015 publish - c#

I remember that in Visual Studio 2010 there was "Replace matching files with local copies" checkbox
Where this checkbox/radiobutton in Visual Studio 2015 ?

In VS2015 it's not possible to set this option in the Publish Window.
But we can do it in another way. Right Click on Project->Properties->Package/Publish Web->Items to deploy
According to MSDN you we have these options
Only files needed to run this application. This is the default value. Visual Studio tries to determine which files are required for
the application to run successfully. For example, this includes
assemblies in the bin folder, files generated during the build, and
files marked as Content. To see if a file is marked as Content, select
the file in Solution Explorer, and check the file's Build Action
property in the Properties window. You can change the Build Action
value to Content to cause the file to be deployed, or change it to
something else, such as None, to prevent the file from being deployed.
Some file types that are automatically set to Content include .master,
.svc, .ashx, .asax, .skin, .browser, .config, .and sitemap. A file
must be included in the project in order to have a Build Action
property.
All files in this project. Visual Studio deploys all files that are included in the project, regardless of their Build Action property
values.
All files in the project folder. Visual Studio deploys all files that are in the project folder and subfolders, regardless of whether
they are included in the project or their Build Action property
values.
UPDATE
I figured out another method how to update all files during publishing. I faced issue when some of my files were not updated properly (config,ascx and etc.), in my inetpub folder I had old version of files. So first I published site in another new folder and then replace files in inetpub folder with files from new folder.

Related

WPF Publish - include folders

I have a WPF project that is now finished, and I want to publish the app into an installer that other people can use.
When I publish the project, the project compiles into setup.exe, but on install the folders that I have do not get included.
I've been reading the guides, and made sure to include the files inside the folders as Content or a Resource. I've also made sure they are always copied. When some of my files are copied, they have a .deploy extension, and I need it to be an .xml in order for some function to read them. Images that I have in the app load fine however.
What do I need to do to have my custom files be EXACTlY as they are, xml as xml, txt as txt and so on. Also I have some empty folders, like this TempCF that I use at some point. Do i need to create it via code?
If you go to Project->Properties->Publish->Install Mode and Settings->Options->Deployment in Visual Studio, there is a "Use ".deploy" file extension" option that you can untick to get rid of the .deploy extension being added to your published files:
Empty project folders are not included in the output. Either put a dummy content file in them or create the folder dynamically as needed during runtime.
# Nikola L.
You could try to use the following methods to add the files in your program to the installation package so that you can have the files you need in your installation path. If I misunderstood your question, please let me know.
The steps are as follows:
1.Right-click on the Setup project and select View -> File System
2.In the File System page, right-click the Application Folder (File System on target Machine) and select Add->Folder(named User's Application Data ) -> Fileā€¦-> find the file under your project and select the file you need.
Such as:
3.Right-click the Setup project.
Install your setup package.
You can find the files you added in your installation path.
The result is like the picture below:

WPF - How can I generate a file inside the directory where the program is installed?

I'm trying to create a WPF application to do some of the time consuming QA tasks easier. Now I ran into problem of creating a file that would be used for configuration of some operation via ssh. This file will contain default configuration, however it might be updated by the user with new values.
I changed the properties of a file to "Build Action - Content" and "Copy to Output Directory - Always" however when I publish and install the application the file is not in the directory.
How can I make the file appear in the output directory and be available for some changes?
The published files get a .deploy extension by default. This is a setting that can be changed under Project->Publish->Options->Deployment in Visual Studio.
If you uncheck the Use ".deploy" file extension option and re-publish, you should see and be able to use the content file in the Application Files/app directory of the output folder.

ASP.NET: Publishing Website doesn't publish Resources folder

I have a website that I'm developing with ASP.NET. I'm using Visual Studio 2015. When I right-click and hit publish website the site publishes correctly except that my resources folder gets left behind. Heres what the solution explorer looks like in Visual Studio
But after I publish it here are the files that get put on Azure (accessed via FileZilla)
How do I tell Visual Studio to publish the Resources folder with the rest of the website?
Likely Answer
Open the Solution Explorer.
Right click one of the files in the Resources directory.
Choose Properties.
You now need to set two properties.
Build Action Content
Copy to Output Directory Do not copy
Do this to all the files that you would like to publish as content to the web server.
File Properties for Web Server Content
Remarks on File Properties
The Build Action property indicates what Visual Studio does with a file when a build is executed. Build Action can have one of several values:
None. Not what you want. The file is not included in the project output group and is not compiled in the build process. An example is a text file that contains documentation, such as a Readme file, that you do not want to publish to the web server.
Compile. Not what you want. The file is compiled into the build output. This setting is used for code files. In other words, we compile the file and the stick it into the bin directory.
Content. This is what you want. The file is not compiled, but is included in the Content output group. For example, this setting is the default value for an .htm or other kind of Web file. The "Content output group" is a list of files that Visual Studio will publish while also maintaining the same directory structure.
Embedded Resource. Not what you want. This file is embedded in the main project build output as a DLL or executable. It is typically used for resource files. In other words, it not only goes into the bin directory but is also embedded within a .dll or .exe file.
Copy to Output Directory. This property specifies the conditions under which the selected source file will be copied to the output directory. The output directory is normally the bin.
See Also
What are the various "Build action" settings in Visual Studio project properties and what do they do?
File Properties on MSDN
If like me you are using Visual studio 2019, just right-click on the folder and select publish "name of the folder"
Steps to add resources to be published (Visual Studio 2017):
1) Right click the resources folder and select "Include In Project"
2) Now you should see Build Action: Content on the properties for the images.
Make sure the contents of your Resources folder have the proper "Copy to Output Directory" property. Right click the files you want to copy over, select Properties, then in the Advanced section look at the value under Copy to Output Directory. Generally this is set to "Do not copy" by default since most things get packaged up in the .dll. Change it to "Copy if newer" to get it to bring over the file. It'll bring over the folder structure as well.

Visual Studio 2010 Manage Output Files

I'm new about code developing with Visual Studio 2010 and I would like to ask you a simple question about something after build a project.
I have a C# project and when I build It in Release mode some file are created and some of them copied from another in to \output\bin\Release\ folder. My question is that How can I manage that which created dll or created file will be in \output\bin\Release\ folder.
I tried to take a look at build properties of project but I could not find any option about it.
Thank you.
Actually I do not need this dll in my project output folder because I
add this dlls as a reference to my project
And this is exactly why this file appear in output folder.
There are several ways to "put" file in output folder. For normal files in the project you can set property Copy to Output Directory.
If we talking about dll's, (as mentioned Hans), there is Copy Local property for each assembly in References.
By default VS set this according to our GAC, so if you are using 3rd part assembly or from another project VS will set this property to True and file will be copied to output folder.
If you don't want to put this file in output folder, just set this property to False. But remember, at run time this assembly should exist.
For more information: How to: Set the Copy Local Property of a Reference
Another explanation: you just messed up with Output path in the project properties and two project has the same output folder. :)
I suggest that you ignore the extra files that are created. One way to do this is to configure the destination of these to a different location.
I use this:
property pages->General
- Output Directory = $(SolutionDir)..\link\
- Intermediate Directory = c:\temp\vc10\$(SolutionName)\$(Configuration)\
Use the same settings for debug and release.

How To Add Files or Directory ClickOnce Deployment

In my project I have a directory that's holding my Report files. When I deploy it to localhost, it's not including this directory. So with a little research I found a solution. I then added a directory to my project in VS and make my report file Build Action Content, Copy Output to Directory property. Now when I publish it, I can see my Reports folder in ClickOnce deploy.
But now it's saying that xcvqw34asdasczxcasdasdasd.3asd\Reports\generalReport.frx is not found, when within my code I call it Reports\\generalReport.frx.
I have corrected the problem. I changed
Reports\\generalReport.frx
to:
.\\Raporlar\\genelRapor.frx

Categories