Output path being ignored when I build solution - c#

I created separate configuration for my C# project. In project settings, for new configuration, I defined different output path (so for Debug I have bin\, for new configuration I have bin\NewConfig).
When I build my project under new configuration nothing appears in bin\NewConfig and from build log I can see that it removes files from bin\ and moves all files here.
How I can make my build files to appear in directory that I define in Output path? Could that setting be overridden or disabled somewhere else?

You have to remember that you are building a solution configuration for which you can choose which configuration of your projects are being built.
Check if the correct configuration of your project is selected for the selected solution configuration...

Related

appname.exe.config not created on windows application

When I build a windows application. It does not work because it cannot read my app.config file. I looked in the bin directory and it does not have the appname.exe.config file. If I manually copy over the app.config and rename it the appname.exe.config the application will work..but when I build the project this file is never created automagically. What am I missing? Why is my project not creating it? I have looked through the whole folder structure and there is no other config files.
Everyone here is giving you false information I think. I think #bowlturner had it right. According to Microsoft, you do need to set the app.config's Copy to output directory property to either Copy Always or Copy if newer. From Microsoft's MSDN Site:
When you develop in Visual Studio, place the source configuration file for your app in the project directory and set its Copy To Output Directory property to Copy always or Copy if newer. The name of the configuration file is the name of the app with a .config extension. For example, an app called myApp.exe should have a source configuration file called myApp.exe.config.
Visual Studio automatically copies the source configuration file to the directory where the compiled assembly is placed to create the output configuration file, which is deployed with the app.
The correct settings are:
Build Action = None
Copy to Output Directory = Do not copy
and very important, the project file needs to contain this element:
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
The only thing that worked for me was to delete bin\ and obj\ entirely. Rebuild and the file is created fine.
Look on App.config properties, should be:
BuildAction: None
CopyToOutputDirectory: Do not copy
Custom tool and custom tool namespace should be empty
Also try to Rebuild project. Right click on project -> Rebuild
Assuming you're using Visual Studio click your config file in the Solution Explorer and and in the Properties panel set Copy To Output Directory to something other than Do Not Copy.

How can I tell VS2010 to include files in my manifest for publishing?

I have an application that is published through the ClickOne mecanism. The issue I'm having is that it is not publishing my NLog.config file, which is required for my application to run. I've looked through the Application Files screen, but I don't see NLog.config as an option to select. My NLog.config file has a built action of Content and is set to copy to the output directory. If it matters the NLog.config file is in another project that is referenced in the project I'm publishing.
I'm aware that I can use MAGE to essentially scan my publishdirectory and have it update my manifest, but what I'm looking for is a way to do it automatically.
What are my options?
Possible Solution
One solution could be to configure NLog through code rather than XML.
I use this great tool too and I have a click-once program too:
In the Solution explorer, click on your nlog.config. In the properties window, put the Build Action as content.
Be sure that you see "Applications files" of the project's properties window.
VoilĂ !

Deploy different WCF .svc files based on configuration

I have a Service1.svc file that is a normal WCF service. If I deploy the WCF project it will happily copy the Service1.svc file along with the binaries and the other files. So far, so good. What I want is, based on the selected build configuration, or some other trick, to publish different contents for the Service1.svc file.
Let's say I have a Service1.Conf1.svc file and a Service1.Conf2.svc file and two configurations (like Debug or Release) that are named Conf1 and Conf2. When I click publish and have the Conf1 configuration selected, I want the publish folder to have a virtually created Service1.svc file whose contents are from Service1.Conf1.svc. When I click publish and have the Conf2 configuration selected, I want the publish folder to have a virtually created Service1.svc file whose contents are from Service1.Conf2.svc.
I would like to have this for the publish action, not the build action (which could be achievable by a post-build or pre-build event). The main purpose is to adjust the contents of the Service1.svc file according to the publish environment.
Any ideas?
We took a different approach and generate all required config/svc files for all possible installs (using TT file generation) and let the installer copy the correct configs/svc files (based on user selection during install).
The names of the files are constructed by inserting the target platform name into the standard name e.g web.local.config, web.dev.config, web.test.config etc
This way you can give one installer to anyone from any department. They just choose the platform.

Force rebuild after Spring config file edit

In our C# project we use Spring as an Inversion of Control (IoC) container. We noticed, that changes to the Spring configuration xml file do not cause the solution to be rebuild. Therefore the changed configuration is not copied to the output folder and every debug-run uses the old configuration.
How can we force Visual Studio (2008) to copy the config file even though none of the project code has changed?
Further info:
The build action of the config file is set to None. Copy to Output Directory is set to Copy always.
Seems the solution is simpler than I thought. If the build action for the *.xml config file is changed to Embedded Resource, then changing the file also touches the project. Therefore, every debug cycle causes a rebuild of the project, where the config file is included. This causes the file to be copied to the output directory with the adjusted configuration. => Problem solved.

Using a c# Setup project, how do I get a config file (nlog.config) into the msi for the Setup project?

The nlog.config is being put into the bin/Debug for my project. In the setup project I have primary output of project a and content files of project a to be included in the Application folder. nlog.config, however is not making to the msi. Any ideas?
Adding the file manually means that you will have to redo the step if you change the file in the source.
Instead, make sure that the build action of your NLog.Config is set to "Content"
Then, add Project Output Group of type "Content Files" in your setup project:
.
I have found a solution to this. Right click on the setup project and choose Add then File. Just select the nlog.config file from the bin directory where it is being placed after a compile and it works perfectly.

Categories

Resources