Questions tagged [buildaction]

36 questions
50
votes
3 answers

Difference between Build action content and 'Copy to output directory' in Visual Studio

In my project in Visual Studio, I have files that I want included in the output, but not compiled or embedded. I am aware that there are 2 ways to accomplish this. Setting the Build Action for the file to 'Content' Setting the 'Copy to Output…
ilias
  • 2,620
  • 2
  • 27
  • 37
47
votes
4 answers

What is Content Build Action in Visual Studio?

What does the Content Build Action in Visual Studio do? It does not look like it's doing anything. The File Properties article on MSDN (does not exist anymore) says: Content - The file is not compiled, but is included in the Content output group.…
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
37
votes
8 answers

Error "A namespace does not directly contain members such as fields or methods"

I'm trying to build my C# project and I'm getting the error message "A namespace does not directly contain members such as fields or methods". It is flagging the first character (the less than symbol) of the app.config file. I've checked all of my…
BoltBait
  • 11,361
  • 9
  • 58
  • 87
31
votes
10 answers

WPF - Image 'is not part of the project or its Build Action is not set to Resource'

I have a project which requires an image in the window. This is a static image and i added through 'Add>Existing Item'. It exists in the root of the project. I reference the image in a test page like so -
EightyOne Unite
  • 11,665
  • 14
  • 79
  • 105
10
votes
2 answers

The difference between "Build", "Compile" and "None" Build actions in Visual Studio Database project

Although I can find (on the web) a lot of information about the PreDeploy and PostDeploy Build Action for SQL scripts in a Visual Studio 2012 Database project and I understand that None does not compile or include the script when deploying, please…
5
votes
5 answers

Changes to appsettings.json config files not picked up?

I recently noticed some strange behaviour in Visual Studio. If I edit my appsettings.json file then run in debug F5, the changed config is not picked up by the compiler.
AndyS
  • 750
  • 5
  • 14
5
votes
1 answer

How to minify JavaScript files that have changed (and only them) when building (aka duplicate items after adding "ItemGroup" to csproj)

I've added the following code to my .csproj in order to minify the JS files that have changed when building the project:
Gyum Fox
  • 3,287
  • 2
  • 41
  • 71
4
votes
1 answer

Any issues setting MVC 3 rc1 Razor cshtml file Build Action to Compile?

The default build action has been changed from "None" to "Content", as I understand to support Visual Studio publish/deploy. For a particular project, I do not use the Visual Studio publish/deploy method, nor need to compile from the command…
Leon van der Walt
  • 997
  • 12
  • 18
4
votes
1 answer

Visual Studio 2012 - How to assign multiple build actions to a TypeScript file

I am using Visual Studio 2012 to create a class library project that will also include a number of TypeScript (.ts) files, as well as their generated .js and .js.map files. All of these files need to be included in the assembly as embedded…
Tim Coulter
  • 8,705
  • 11
  • 64
  • 95
3
votes
2 answers

How to get C# library file in output directory?

I have a solution with a few projects: library.dll with something.json webapp.dll winapp.exe 2 and 3 depend on 1, not on eachother. I would like copy something.json to the bin directory of winapp.exe However setting the properties to Content and…
online Thomas
  • 8,864
  • 6
  • 44
  • 85
3
votes
2 answers

How can I open a file I've added to my Windows Store App project programatically?

I want to load a PDF file in response to a Tapped event. I added the file to my project (Add > Existing Item), set "Build Action" to "Content" and "Copy to Output Directory" to "Copy if newer" I'm thinking the code I need may be something like…
2
votes
1 answer

More resource confusion

I have a project that has a bunch of images in the project tree. One of the images has the BuildAction set to Content, but Copy to Output Directory is set to None. What exactly happens to this resource? Does it get compiled into the EXE? From what…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
2
votes
2 answers

How come my Windows Service cannot access a folder with files in them?

I have setup a Console, Library, and Service project. The Library project loads up files in a folder and stores the text in variables. The console project will then manipulate those variables. I am able to run the Console project successfully and…
Steven Combs
  • 1,890
  • 6
  • 29
  • 54
1
vote
2 answers

Which Build Action (C# Microsoft Visual Studio) is suitable for launching an .exe software which has zero or more dependents within a Windows Form?

Consider these two software: MyGame.exe and SocketTest.exe. MyGame.exe doesn't depend on any files to run but SocketTest.exe is an actual software. It can only run if one or more of four other files are in the same folder as itself. These files are:…
Stoverflow
  • 65
  • 6
1
vote
1 answer

WPF How to modify resource/content file inside my project folder at runtime (NOT in bin directory)? Implementing "Recent changes" section

I would like to modify the contents of a file placed in my project folder (Specifically "Assets/recentChanges.txt") at runtime. Let's say it contains information about recent changes in application. It is supposed to be read and bound to a textbox…
1
2 3