首页 \ 问答 \ Visual Studio不复制链接文件的目录(Visual Studio not Copying Directory of Linked Files)

Visual Studio不复制链接文件的目录(Visual Studio not Copying Directory of Linked Files)

暂存非托管库或资源时的常见做法是将这些资源添加为项目的链接,并将它们设置为复制到输出目录。

从Visual Studio 2013开始,这种处理方式非常好,即使它们被引用了库Foo ,然后它将被应用程序Bar ,它们也会以Bar的输出目录结束。

尽管如此,文件目录似乎也是如此。

库中的引用文件

在这种情况下,我的应用程序似乎只在重建时才将此文件目录复制到输出目录。 然后不可避免地我会做一些构建操作,我会注意到Libs目录又是空的。 然后做一个重建cef.pak回来。

我的解决方案是使用Build StepLibs目录手动复制到输出目录。 尽管我找不到适当的宏来一般表达,即使这个构建步骤是Foo一部分,我也希望将这些文件复制到条(例如VS中的StartUp Project )输出目录中。

更新

感谢大家的好评和测试。 我应该澄清一点,如果两者之间存在额外级别的库,我仍然会看到这个问题。 也就是说应用程序Bar引用库Foo引用库Other是这些链接文件之一。 在这种情况下,当Other人的链接文件被设置为复制到输出目录时,他们似乎只在重建时进行。 我对此的解决方案不太理想,即直接让Foo参考Other


A common practice when staging unmanaged libraries or resources is to add those resources as links to the project and set them to copy to the output directory.

As of Visual Studio 2013, this is handled quite well and even if they are referenced Library Foo which is then consumed by Application Bar, they will end up in Bar's output directory.

The same doesn't appear to be true for directories of files though.

Referenced file in library

In this case, my application appears to only copy this directory of files to the output directory on rebuild only. Then inevitably I'll do a couple build actions and I'll notice the Libs directory is empty again. Then do a Rebuild and cef.pak is back.

My solution to this was to employ a Build Step to copy the Libs directory manually to the output directory. Though I cannot find the proper macro to generically express that even though this build step is part of Foo, I want the files copied to the Bar's (e.g. StartUp Project in VS terms) output directory.

Update

Thank you everyone for the great answers and testing this. I should clarify that I still see this issue when there is an extra level of library in between. That is to say Application Bar referencing library Foo which references library Other which is the one w/ these linked files. In that case, when Other's linked files are set to copy to output directory, they seem to only make it on rebuilds. My solution to this is less than ideal which is to have Foo reference Other directly.


原文:https://stackoverflow.com/questions/28700668
更新时间:2021-08-08 15:08

最满意答案

你需要在navigationBar添加menuView

let menuView = UIView()
menuView.backgroundColor = .red
menuView.translatesAutoresizingMaskIntoConstraints = false

self.navigationController?.navigationBar.addSubview(menuView)

[menuView.leadingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.leadingAnchor)!),
menuView.topAnchor.constraint(equalTo: (self.navigationController?.navigationBar.bottomAnchor)!),
menuView.trailingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.trailingAnchor)!),
menuView.heightAnchor.constraint(equalToConstant: 60)].forEach{ $0.isActive = true }

结果

在这里输入图像描述

但是你必须保持UITableView / UICollectionView / UIScrollView&Scroll指标的contentInset

建议

在这种情况下使用TableView / CollectinView的Section Header。


You need to add menuView in navigationBar

let menuView = UIView()
menuView.backgroundColor = .red
menuView.translatesAutoresizingMaskIntoConstraints = false

self.navigationController?.navigationBar.addSubview(menuView)

[menuView.leadingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.leadingAnchor)!),
menuView.topAnchor.constraint(equalTo: (self.navigationController?.navigationBar.bottomAnchor)!),
menuView.trailingAnchor.constraint(equalTo: (self.navigationController?.navigationBar.trailingAnchor)!),
menuView.heightAnchor.constraint(equalToConstant: 60)].forEach{ $0.isActive = true }

Result

enter image description here

But you have to maintain contentInset of UITableView/UICollectionView/UIScrollView & Scroll indicator

Suggestions

Use Section Header of TableView/CollectinView in this type of situation.

相关问答

更多
  • 看起来我需要做的是检查设备是否运行的版本低于iOS 7,然后设置 [[[self navigationController] navigationBar] setTintColor:[UIColor blackColor]]; Looks like what I needed to do was check if the device was running a version less than iOS 7, then set [[[self navigationController] navigati ...
  • 您的约束可能设置为topLayoutGuide ,而不是视图的顶部。 顶部布局指南包含UINavigationBar和状态栏(如果存在),但将约束设置到视图顶部不会针对UINavigationBar (或状态栏)进行调整。 Your constraint is probably set to the topLayoutGuide, rather than the top of the view. The top layout guide includes the UINavigationBar and St ...
  • 我找到了解决方案。 我双击隐藏文本字段的导航栏区域,然后从中选择绘图>视图>隐藏。 隐藏的复选框未选中,所以我检查了一下,这使得用户名字段在导航栏中可见(奇怪!)然后我将其拖出那里并将其移动到导航栏下方。 我仍然想知道是否有更好的方法可以做到这一点,我确信有! 但这至少是某种解决方案。 (我仍然无法在我的场景轮廓中看到导航项) I found a solution. I double clicked inside the navigation bar area where the textfield is ...
  • 保持挖掘视图的层次结构,如果UIScrollView位于视图的顶部,那么任何视图都将不会接收任何触摸事件。 添加了XIB的导航栏是主视图中子视图的一部分,因此您必须在导航栏下启动UIScrollView,y = 44 ScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 44, self.view.frame.size.width,self.view.frame.size.height-44)]; 并且不要忘记从ScrollView高 ...
  • 我在导航控制器内找到了解决方案导航控制器 I found the solution Navigation controller inside navigation controller
  • 你需要在navigationBar添加menuView let menuView = UIView() menuView.backgroundColor = .red menuView.translatesAutoresizingMaskIntoConstraints = false self.navigationController?.navigationBar.addSubview(menuView) [menuView.leadingAnchor.constraint(equalTo: (self ...
  • 我刚刚启动了一个应用程序,并有同样的问题,您正在寻找的行是: self.navigationController.navigationBar.hidden = YES; 完整代码是: - (void)viewWillAppear:(BOOL)animated { self.navigationController.navigationBar.hidden = YES; } 确保你用下一个控制器重新开启它: self.navigationController.navigationBar.hidd ...
  • 您是否确定选中了“属性”检查器中“显示导航栏”的复选框? 编辑 我看到你正在使用这一行: [viewControllers addObject:r] 你为什么做这个? 您的UINavigationController应配置为“初始视图控制器”。 您已经将segue设置为UITableViewController,因此应该可以正常工作。 编辑2 我认为这会导致问题: UIStoryboard *sb = [UIStoryboard storyboardWithName:@"RecentCalls" bund ...
  • //set navigation bar tint color [self.navigationController.navigationBar setTintColor:[UIColor blueColor]]; //or to set its style [self.navigationController.navigationBar setBarStyle:UIBarStyleDefault]; //set navigation bar tint color [self.navigationCon ...
  • 您不应该自己添加导航栏。 当场景嵌入导航控制器或导航堆栈的一部分时,界面构建器将自动执行此操作。 因此,如果您的tableview是根控制器,请选择您的场景,然后转到: 编辑器>嵌入>导航控制器 否则,当您将另一个控制器(即堆栈的一部分)的segue连接到tableview控制器时,将自动添加导航栏。 You should not add the navigation bar yourself. Interface builder will do that automatically when a scen ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)