buildaction

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

﹥>﹥吖頭↗ 提交于 2020-01-04 02:32:51
问题 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 this: async Task LoadTutorial() { await Launcher.LaunchUriAsync(new Uri("what should be here to access the output folder?")); } If I'm right, what do I need to pass as the Uri? Otherwise, how is this accomplished? UPDATE On a related note, to add an

WPF C# Reflection: Iterate over all resources with build action “Page”

孤者浪人 提交于 2019-12-13 22:18:20
问题 I have a .dll with a lot of ResourceDictionaries. The build action of all these ResourceDictionaries is set to "Page" . Inside the Dll, I want to find all these ResourceDictionaries and iterate over them. If I set the build action to "EmbeddedResource", I can use Reflection: var embeddedResources = Assembly.GetExecutingAssembly().GetManifestResourceNames().ToList(); But GetManifestResourceNames() does not work for resources with build action "Page". How do I find or iterate over all resources

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

偶尔善良 提交于 2019-12-13 02:45:01
问题 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 it loads the files without a problem. The files are set to Copy Always in the DLL and are specified as Content for the Build Action. When I try to run the exact same code in the service. File.ReadAllText(@"MyFolder\SomeFile.txt"); It throws the

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

喜欢而已 提交于 2019-11-30 05:43:43
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 - <Page x:Class="Critter.Pages.Test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test"> <Image Source="bug.png"/> </Page> Problem is I get a message saying it can't be found or it's build action isn't resource but it DOES exist and it's build action IS resource. If i create a new application and just throw it on

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

怎甘沉沦 提交于 2019-11-30 05:36:12
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 Directory' to 'Copy Always' or 'Copy if newer' Can someone tell me what the difference is and which scenario is each of the options appropriate for? Oded When setting the Build Action to Content , the file will not be compiled and will be put in the Content output group. Whether the file gets copies or not depends on the Copy to Output Directory setting

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

假如想象 提交于 2019-11-29 04:53:52
问题 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 - <Page x:Class="Critter.Pages.Test" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Test"> <Image Source="bug.png"/> </Page> Problem is I get a message saying it can't be found or it's build action isn't resource

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

会有一股神秘感。 提交于 2019-11-29 04:38:34
问题 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 Directory' to 'Copy Always' or 'Copy if newer' Can someone tell me what the difference is and which scenario is each of the options appropriate for? 回答1: When setting the Build Action to Content , the file will not be compiled and will be put in the

What is Content Build Action in Visual Studio?

自古美人都是妖i 提交于 2019-11-28 07:10:10
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. For example, this setting is the default value for an .htm or other kind of Web file. But I have no idea what the "Content output group" means. Is this something about deployment? Meaning, the action has no actual effect, when building, but only later when deploying? "Content" means that it is a deployable project item, it signals that the file needs

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

我们两清 提交于 2019-11-27 09:00:37
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 files for places where there are variables or functions directly inside of a namespace--found nothing. The app.config looks fine. Google is failing me and I'm pulling my hair out. What could be causing this error? Figures! As soon as I finally break down and ask the question that I find the answer... The app.config file properties section (somehow)

What is Content Build Action in Visual Studio?

江枫思渺然 提交于 2019-11-26 20:19:16
问题 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. For example, this setting is the default value for an .htm or other kind of Web file. But I have no idea what the "Content output group" means. Is this something about deployment? Meaning, the action has no actual effect, when building, but only