问题标签 [buildaction]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c# - 当内容资源设置为更新时如何移动内容资源?
我Dependencies
在项目中放入文件夹的资源很少。
复制到输出目录设置为如果更新则复制
默认行为是它将复制到\bin\Dependencies\*
我想将其设置为复制到\bin\*
如何做到这一点?
windows-phone-7 - phonegap windows phone 复制现有的 www 过吗?
我创建了一个 phonegap windows phone 项目,进行了安装和设置。当我运行模拟器时,它使用演示/默认代码运行良好。我有一个现有的 android 项目。我将我的 www 文件夹拖到 windows 项目中,但没有任何效果。manifestprocessor.js 不会在 xml 中构建任何新文件。当我右键单击我的新文件时,我没有选择构建操作的选项。我在构建时没有收到任何错误。我还要注意,我的默认 htnl 文件应该加载 login.html(我更新了 CordovaView.xaml.cs 文件),并且 cordova.js 文件位于 www 的“js”文件夹中,而不是像默认设置那样位于根目录中.
有人有想法么?我从来没有使用 Visual Studio 开发过,我猜我需要让我的新文件被识别,这样我才能分配我猜的构建操作,但因为它不会让我不知道该怎么做,或者即使那是问题。
感谢您的时间和建议。
c# - 一种为 NHibernate 映射 .hbm.xml 文件配置构建操作的方法?
有没有办法从 NHibernate 映射 .hbm.xml 文件本身或至少另一个配置 xml 文件中为 NHibernate 映射 .hbm.xml 文件配置构建操作?
尽管我很欣赏 Microsoft Visual Studio 2010 的许多功能,但我不喜欢通过执行以下操作手动将“嵌入式资源”设置为此 hbm.xml 文件的构建操作:
- (不喜欢手动方法)(Microsoft 支持文档)右键单击感兴趣的文件,然后选择属性。
- (不喜欢手动方法)(Microsoft 支持文档)在“属性”对话框中,找到“生成操作”属性。默认情况下,此属性设置为内容。单击该属性并将 Build Action 属性更改为 Embedded Resource。
另外,我不喜欢在 CSharp 代码中以编程方式进行操作。有没有办法从 NHibernate 映射 .hbm.xml 文件本身或至少另一个配置 xml 文件中为 NHibernate 映射 .hbm.xml 文件配置构建操作?有人可以建议我如何使用xml来做到这一点吗?
visual-studio - Visual Studio 2012 - 如何将多个构建操作分配给 TypeScript 文件
我正在使用 Visual Studio 2012 创建一个类库项目,该项目还将包含许多 TypeScript ( .ts
) 文件,以及它们生成的.js
文件.js.map
。所有这些文件都需要作为嵌入式资源包含在程序集中,以便它们可以通过自定义的VirtualPathProvider
.
注意:虽然只有生成的 JavaScript 文件对于生产环境是必不可少的,但.ts
和.js.map
文件也必须可供 Web 应用程序访问,以进行调试。
这会产生冲突,因为通常为 TypeScript 文件分配TypeScriptCompile
构建操作,但我也需要分配它们EmbeddedResource
。
有没有办法将多个构建操作分配给 VisualStudio 项目组件?或者,是否有另一种方法可以让 TypeScript 编译未明确标记为的文件TypeScriptCompile
或让 Visual Studio 嵌入未标记为的文件EmbeddedResource
?
谢谢你的建议,
蒂姆
c# - 为图像文件或一般文件设置默认构建操作
我正在使用 Xamarin Studio。是否可以为自定义文件或图像文件设置默认构建操作?
我正在开发一个使用大量 PNG 图像的应用程序。BundleResource 默认为我导入到项目中的每个图像设置。我注意到当我使用Content而不是默认的BundleResource构建图像时,我的内存使用量减少了约 25mb(从 220 到约 193mb)。
“MonoDevelop 应该自动选择 BundleResource 构建操作,但您可以在每个文件的属性中手动检查或设置它。”
- http://docs.xamarin.com/guides/ios/platform_features/monodevelop_features
c# - 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 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.
It throws the following exception.
I am using the Setup Project type to create the installer. After the service installs the folder MyFolder
does exist in the Application Folder of the service, as well as the files. What else could be causing my problem for the service not being able to read those files?
EDIT 1
wpf - 从 WPF 中的 EmbeddedResource 加载和检查 ResourceDictionary Uri
我需要在运行时从一些程序集中加载我的ResourceDictionary 。
首先,我将ResourceDictionary 的BuildAction设置为Page,并使用代码来构建 uri。
那行得通,但后来我意识到,在将 uri 设置为我的 ResourceDictionary 之前,我需要检查程序集。因为,如果 ResourceDictionary 不在程序集中,则会引发异常。
因此,我将 ResourceDictionary 的 BuildAction 设置为EmbeddedResource,以便使用以下代码查看程序集中的 ResourceDictionary:
但是现在,我无法使用 uri 加载 ResourceDictionary。我已经尽我所能,但没有成功。
任何想法?谢谢!
visual-studio - 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. 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?
c# - 在 VS 中为 Win 8.1 应用程序中的文件夹设置构建操作
在以前的 Windows 8 /8.1 项目中,我添加到 Assets 文件夹内的文件夹中的任何图像都会在 Build Action 中自动设置为“Content”。
因此,图像会在项目构建时呈现。
但是我们最新的项目似乎默认为 BundleResource,在浪费时间试图弄清楚为什么图像没有渲染之后,我记得我必须手动将每个图像更改为 Content。
有谁知道如何将整个文件夹设置为内容,以便新添加的图像默认为内容?我不知道为什么这个项目的行为与我们以前的项目不同。:-(
c# - 如何以编程方式打开已添加到 Windows Store App 项目中的文件?
我想加载 PDF 文件以响应 Tapped 事件。
我将文件添加到我的项目(添加>现有项目),将“构建操作”设置为“内容”,将“复制到输出目录”设置为“如果更新则复制”
我在想我需要的代码可能是这样的:
如果我是对的,作为 Uri 我需要传递什么?否则,这是如何实现的?
更新
在相关说明中,要使用建议的方案将图像添加到 XAML,我认为这会起作用:
...但事实并非如此。
更新 2
尝试打开 PDF 文件(位于项目的根目录中,而不是在子文件夹中):
...导致这个运行时异常,在上面的第一行抛出:
更新 3
有了这个,改编自提供的链接:
...我得到编译时错误:
'Windows.System.Launcher.LaunchFileAsync(Windows.Storage.IStorageFile)' 的最佳重载方法匹配有一些无效参数
-和:
参数 1:无法从 'Windows.Foundation.IAsyncOperation' 转换为 'Windows.Storage.IStorageFile'
...在最后一行。
更新 4
根据 Lecrenski、Netherlands、Sanders 和 Ashely 的“Pro Windows 8 Programming”的第 76 页,这应该有效:
...(IOW,“ ms-appx:/// ”爵士乐是不必要的),它或多或少确实如此。在我的特殊情况下,对于我的(大)图像,我必须这样做:
如果没有宽度和高度设置,图像会显示得比犀牛大,并紧贴弹出窗口的右侧。
更新 5
我发现这可以打开 PDF 文件(“PlatypusTut.pdf”已添加到项目中,“构建操作”设置为“内容”,“复制到输出目录”设置为“如果较新则复制”):
...但我想知道这是否只能在本地设计时工作。当安装在用户的机器上时,这也能工作吗?IOW,只需将“PlatypusTut.pdf”传递给 GetFileAsync() 就足够了吗?