我有C#几个项目的解决方案Visual Studio 2010.一个是测试项目(我将其称为" PrjTest "),另一个是Windows Forms Application项目(我将其称为" PrjForm ").还有一个由PrjForm引用的第三个项目,它能够成功引用和使用.
PrjForm引用PrjTest,而PrjForm有一个带有using语句的类:
using PrjTest;
Run Code Online (Sandbox Code Playgroud)
using 声明正确到位using PrjTest;出现错误:找不到类型或命名空间名称'PrjTest'(您是否缺少using指令或程序集引用?)
我尝试过以下方法来解决这个问题:
VS 2010我做完了我的功课,花了很长时间在线寻找答案,但这些解决方案都没有帮助.
我还能尝试什么?
c# reference using-directives using-statement visual-studio-2010
一点背景......我对javascript和phantom.js有点新,所以我不知道这是一个javascript还是phantom.js bug(功能?).
以下成功完成(对于缺少的phantom.exit(),您只需要在完成后按ctrl + c):
var page = require('webpage').create();
var comment = "Hello World";
page.viewportSize = { width: 800, height: 600 };
page.open("http://www.google.com", function (status) {
if (status !== 'success') {
console.log('Unable to load the address!');
phantom.exit();
} else {
page.includeJs('http://code.jquery.com/jquery-latest.min.js', function() {
console.log("1: ", comment);
}, comment);
var foo = page.evaluate(function() {
return arguments[0];
}, comment);
console.log("2: ", foo);
}
});
Run Code Online (Sandbox Code Playgroud)
这有效:
page.includeJs('http://code.jquery.com/jquery-latest.min.js', function() {
console.log("1: ", comment);
}, comment);
Run Code Online (Sandbox Code Playgroud)
输出:1: Hello World
但不是:
page.includeJs('http://code.jquery.com/jquery-latest.min.js', function(c) { …Run Code Online (Sandbox Code Playgroud) 是否有人知道c#的Winforms控件类似于stackoverflow使用的Tags控件(见下文)?

如果没有,你用来处理标签的一些好的替代品是什么?
Windows SDK for Server 2008不包含Inspect.exe.有谁知道我在哪里可以找到Inspect.exe或AccExplorer32.exe的副本?我正在运行64位版本的Windows Server 2008 R2.
使用此代码:
public void InstallPackage(Project project, string packageId, string version, string packageSource)
{
var componentModel = (IComponentModel)Package.GetGlobalService(typeof(SComponentModel));
var installer = componentModel.GetService<IVsPackageInstaller>();
installer.InstallPackage(packageSource, project, packageId, version, false);
}
Run Code Online (Sandbox Code Playgroud)
EntityFramework 6.1.3例如,当我尝试安装时,它只是挂起就installer.InstallPackage()行了.我让它运行长达10分钟,没有任何响应,错误,消息或任何关于发生了什么的指示.
我尝试了以下包源:
都具有相同的结果.同样的事情发生的每包我试过(Newtonsoft.Json,Unity,等),所以它不只是EntityFramework.
这是在VS 2015和.Net 4.5.1中运行的.我已经引用了这个NuGet.VisualStudio 2.8.6包,但我也尝试过2.8.5和2.8.3但没有成功.
手动安装程序包(通过Visual Studio中的NuGet程序包管理器UI)按预期工作.
我也尝试了这个NuGet.CommandLine 2.8.6包,具有以下实现:
public void InstallPackage(Project project, string packageId, string version, string packageSource)
{
var repo = PackageRepositoryFactory.Default.CreateRepository("https://nuget.org/api/v2");
// Get the package install path
var solutionDirectory = Path.GetDirectoryName(project.DTE.Solution.FullName); …Run Code Online (Sandbox Code Playgroud) 这个(LINQPad代码段):
DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzz").Dump();
DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:sszzz").Dump();
Run Code Online (Sandbox Code Playgroud)
返回:
2016-01-08T09:05:04-07:00 // Expected
2016-01-08T16:05:04-07:00 // Not what I expected
Run Code Online (Sandbox Code Playgroud)
鉴于第二个结果是通用时间,我预计它会返回2016-01-08T16:05:04-00:00(时区偏移为零).
我错过了什么或这是一个错误吗?
与以下内容相关但不重复:访问 Angular 2 应用程序的路由时如何在 URL 中保留查询字符串参数?
我有一个非常基本的 Angular 应用程序,当我添加查询参数时,它会在代码命中构造函数之前被删除(从浏览器的 URL 和其他任何地方)app.component。
注意:在初始加载(以及随后的重新加载)时,查询参数似乎被剥离
示例:导航至localhost:8081/calculator?a=1更改为localhost:8081/calculator
我在 Angular 4.3.1、4.4.6 和 5.0.4 中尝试过此操作,结果相同。
这是我的路线配置:
const appRoutes: Routes = [
{
path: 'calculator',
component: CalculatorComponent
}
];
export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
Run Code Online (Sandbox Code Playgroud)
这是主应用程序组件的构造函数:
public constructor(private router: Router, private route: ActivatedRoute) {
console.log('entered app constructor');
this.route.queryParamMap.subscribe(params => {
console.log('app', params);
});
}
Run Code Online (Sandbox Code Playgroud)
这是计算器组件的构造函数:
constructor(private router: Router, private route: ActivatedRoute) {
console.log('entered calc constructor');
this.route.queryParamMap.subscribe(params => {
console.log('calc', params); …Run Code Online (Sandbox Code Playgroud) 我在接口中有以下方法签名:
public interface ISettingsUtil
{
T GetConfig<T>(string setting, dynamic settings);
}
Run Code Online (Sandbox Code Playgroud)
我试图嘲笑:
var settingsUtil = Substitute.For<ISettingsUtil>();
var maxImageSize = settingsUtil.GetConfig<long>("maxImageSize",
Arg.Any<dynamic>()).Returns(100L);
Run Code Online (Sandbox Code Playgroud)
这会Microsoft.CSharp.RuntimeBinder.RuntimeBinderException在第二行引发异常:
'long'不包含'Returns'的定义
有关如何T GetConfig<T>(string setting, dynamic settings)正确模拟的任何想法?
我一直遇到Html Agility Pack的问题; 我的XPath查询只有在非常简单时才能工作:
//*[@id='some_id']
Run Code Online (Sandbox Code Playgroud)
要么
//input
Run Code Online (Sandbox Code Playgroud)
但是,只要它们变得更复杂,那么Html Agility Pack就无法处理它.这是一个演示问题的示例,我使用WebDriver导航到Google,并返回页面源,传递给Html Agility Pack,WebDriver和HtmlAgilityPack都尝试定位元素/节点(C#):
//The XPath query
const string xpath = "//form//tr[1]/td[1]//input[@name='q']";
//Navigate to Google and get page source
var driver = new FirefoxDriver(new FirefoxProfile()) { Url = "http://www.google.com" };
Thread.Sleep(2000);
//Can WebDriver find it?
var e = driver.FindElementByXPath(xpath);
Console.WriteLine(e!=null ? "Webdriver success" : "Webdriver failure");
//Can Html Agility Pack find it?
var source = driver.PageSource;
var htmlDoc = new HtmlDocument { OptionFixNestedTags = true };
htmlDoc.LoadHtml(source);
var nodes = htmlDoc.DocumentNode.SelectNodes(xpath);
Console.WriteLine(nodes!=null …Run Code Online (Sandbox Code Playgroud) 这与我之前的问题有关,但似乎我有另一个案例,其中Html Agility Pack无法按预期工作.
这是Html(删除了必需品,删除了敏感信息):
<html>
<select id="one-time-payment-form:vendor-select-supplier">
<option value="1848">Frarma Express</option>
<option value="2119">Maderas Garcia</option>
<option value="1974">Miaris, S.A.</option>
<option value="3063">Ricoh Panama</option>
<option value="3840">UNO EXPRESS</option>
<option value="68">Garrett Blaser Gretsch</option>
<option value="102">Oriel Antonio Grau</option>
</select>
</html>
Run Code Online (Sandbox Code Playgroud)
这是代码:
const string xpath = "//*[contains(@id, 'one-time-payment-form:vendor-select-')]/option[contains(text(), 'UNO EXPRESS')]";
var driver = new FirefoxDriver(new FirefoxProfile()) { Url = "PATH_TO_FILE_CONTAINING_HTML_SHOWN_ABOVE" };
Thread.Sleep(2000);
//Can WebDriver find it?
var e = driver.FindElementByXPath(xpath);
Console.WriteLine(e!=null ? "WebDriver success" : "WebDriver failure");
//Can Html Agility Pack find it?
var source = driver.PageSource; …Run Code Online (Sandbox Code Playgroud) 例如,我创建了一个名为的批处理文件concatenate.bat:
@echo off
set foo=%1\bar
echo %foo%
Run Code Online (Sandbox Code Playgroud)
当我跑步 concatenate.bat "C:\somewhere\with spaces"
我想要foo输出:
"C:\somewhere\with spaces\bar"
但是我得到了:
"C:\somewhere\with spaces"\bar
我也尝试过: set "foo=%1\bar"
哪个输出: "C:\somewhere\with spaces"\bar
正确的方法是什么?
c# ×7
webdriver ×2
xpath ×2
.net ×1
angular ×1
batch-file ×1
datetime ×1
generics ×1
javascript ×1
linqpad ×1
nsubstitute ×1
nuget ×1
phantomjs ×1
reference ×1
typescript ×1
utc ×1
vsix ×1
winapi ×1
winforms ×1