使用MSTest.exe,您可以通过/TestSettings/Execution/Timeouts/@runTimeout在.testsettings文件中设置属性来指定测试运行的总超时.
使用VSTest.Console.exe时,.testsettings已被弃用,转而使用.runsettings,它显然具有完全不同的模式(使用稀疏文档).我知道我可以配置.runsettings文件以使用传统的MSTest模式(从而允许我使用.testsettings文件),但我希望尽可能避免使用.
有没有办法在.runsettings文件中设置运行超时?或者有不同的方法来获得相同的效果?
我和朋友一起在C做了一些小练习,并且我一直习惯使用较新语言的关键词(例如bool,new).我花了一段时间才意识到这是问题因为VS一直把它们强调为关键词,即使它们不在C中.
我确保我的所有文件都是*.c,并且我将项目属性设置为C编译.但是,除了C关键字之外,编辑器总是为C++关键字添加语法highlightint.有没有办法告诉Visual Studio我只想要普通的C?
如果重要,请使用VS2010.
Microsoft 将 VSIX 更改为与 VS2019 异步,随之而来的是悲伤。
我看到很多警告说:
警告 VSTHRD010 访问“项目”应该只在主线程上完成。首先调用 Microsoft.VisualStudio.ProjectSystem.IProjectThreadingService.VerifyOnUIThread()。
我确实添加了,虽然想删除 Nuget 包Microsoft.VisualStudio.ProjectSystem,但没有帮助。
将该行添加到方法的顶部会产生:
错误 CS0120 非静态字段、方法或属性“IProjectThreadingService.VerifyOnUIThread()”需要对象引用
搜索对解决最后一个错误没有帮助。
我尝试添加:
`Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
但这并没有改变事情。
想法?
更新
我认为接近投票是来自说提供代码的用户。没有“代码”。任何从 VS2019 之前升级到 VS2019 并遇到同步 VSIX 到异步 VSIX 的人都会理解这个问题。不能像以前那样只使用物品。由于 VS 现在将许多元素仅分类为“主 UI 可访问”,因此出现了许多此类警告。这意味着
if (null == oItems || 0 == oItems.Count)
return false;
Run Code Online (Sandbox Code Playgroud)
不再有效。oItems 定义为 EnvDTE。ProjectItems. Hence the warning访问 ProjectItems . Basically, anything inEnvDTE` 是不受限制的。
代码将是任何接触/使用 EnvDTE 对象的东西。
对答案 1 的回应
我实现了答案并抛出了一个新错误。
private void MenuItemCallback(object sender, EventArgs e)
{
info VSTHRD102 …Run Code Online (Sandbox Code Playgroud) 我正在开始使用一个小型的内部Web应用程序,主要是概念验证,但我们希望将其视为"真正的"应用程序.作为一名DBA,我没有太多的经验,我的小组也没有这方面的经验(因为它是一个PoC,因此拥有一个并不是特别重要).
我想知道,如果这个网络应用程序上市,我们是否应该为数据库服务器分别设置不同的查询类型?例如,有一个用于SELECT查询的SQL帐户,另一个用于UPDATE/DELETE?我不能说服自己这样做有什么特别的优势,但我之前听说过这种技术,所以必须有一些价值.
我编写了一个小应用程序,它以编程方式创建了一个视觉效果,我试图将它打印在横向页面上(它以纵向剪辑)。当我打印时,它确实以横向方式出现,但我的视觉仍然被剪裁,因为它仅限于纵向。
这是我的代码:
StackPanel page = new StackPanel();
// ... generate stuff to the page to create the visual
PrintDialog dialog = new PrintDialog(); // System.Windows.Controls.PrintDialog
bool? result = dialog.ShowDialog();
if(result.HasValue && result.Value)
{
dialog.PrintTicket.PageOrientation = PageOrientation.Landscape;
Size pageSize = new Size { Width = dialog.PrintableAreaWidth,
Height = dialog.PrintableAreaHeight };
// pageSize comes out to {1056, 816}, which is the orientation I expect
page.Measure(pageSize);
// after this, page.DesiredSize is e.g. {944, 657}, wider than portrait (816).
page.UpdateLayout();
dialog.PrintVisual(page, "Job description");
} …Run Code Online (Sandbox Code Playgroud) 当我尝试设置断点时,什么也没有发生;我将光标放在该println!行上并按F9。
fn main() {
println!("Hello, world!");
}
Run Code Online (Sandbox Code Playgroud)
我在另一台安装了 Visual Studio 2017 的机器上工作,所以我怀疑这可能是问题所在。
任务文件
fn main() {
println!("Hello, world!");
}
Run Code Online (Sandbox Code Playgroud)
启动文件
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build",
"type": "shell",
"command": "cargo build",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"clear": true
},
"problemMatcher": {
"owner": "rust",
"fileLocation": [
"relative",
"${workspaceRoot}"
],
"pattern": {
"regexp": "^(.+):(\\d+):(\\d+):\\s+(\\d+):(\\d+)\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": …Run Code Online (Sandbox Code Playgroud)