小编cas*_*ere的帖子

Specflow - GenerateFeatureFileCodeBehindTask 意外失败

我对 SpecFlow 有问题。我们正在使用 Azure Devops,当我在本地机器上构建解决方案时,它运行良好,但在 Azure Devops 构建期间,我收到以下错误:

[error]C:\Windows\ServiceProfiles\NetworkService\.nuget\packages\specflow.tools.msbuild.generation\3.1.86\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): Error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'. The system cannot find the file specified.
File name: 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at …
Run Code Online (Sandbox Code Playgroud)

selenium nunit specflow azure-automation azure-devops

13
推荐指数
3
解决办法
8063
查看次数

Html.TextBoxFor在POST操作中不显示更新的值

在我看来,我有

      <%:Html.LabelFor(model => model.IPAddress)%>

    <div class="editor-field">
        <%:Html.TextBoxFor(model => model.IPAddress)%>
        <%:Html.ValidationMessageFor(model => model.IPAddress)%>
    </div>
Run Code Online (Sandbox Code Playgroud)

在我的控制器(post方法)中,我有这个

[HttpPost]
public ActionResult Manipulation(MyModel model){
  //I change modele here
  if(something)
    model.IPAddress="100.100.100.100";
  return View(model);
}
Run Code Online (Sandbox Code Playgroud)

所以,我的问题是:当我改变模型时,TextBoxFor不会改变他的值.当我从get方法到帖子时,TextBoxFor得到他的值,后来我无法改变TextBoxFor的值.我调试,我的模型有新值,但TextBoxFor没有显示新值.

你能帮助我吗?

asp.net-mvc

12
推荐指数
2
解决办法
6433
查看次数

错误:不允许使用字符串类型(在'screenOrientation'中,值为'sensorPortait')

我导入了android项目,我得到了3个错误

error: Error: String types not allowed (at 'screenOrientation' with value 'sensorPortait'). AndroidManifest.xml /com.cartmillimaging.fishingmate.MapViewActivity    line 16 Android AAPT Problem
Run Code Online (Sandbox Code Playgroud)

不同行上的错误相同.

<activity android:name=".MapViewActivity" android:screenOrientation="sensorPortait">
Run Code Online (Sandbox Code Playgroud)

对于项目构建目标,我选择了Google API 2.3.3.10.我还启用了Java编译器项目特定设置,并将编译器合规性错误设置为1.6.

我是android开发新手,你能帮助我吗?

android

9
推荐指数
2
解决办法
1万
查看次数

如何从Windows服务打印PDF文档

我有Windows服务,必须定期从服务器打印PDF文档.我的功能是

private void PrintFormPdfData(byte[] formPdfData)
{
    string tempFile;

    tempFile = Path.GetTempFileName();

    using (FileStream fs = new FileStream(tempFile, FileMode.Create))
    {
        fs.Write(formPdfData, 0, formPdfData.Length);
        fs.Flush();
    }

    string pdfArguments = string.Format("/p /h\"{0}\"", tempFile);

    string pdfPrinterLocation = @"C:\Program Files (x86)\Adobe\Reader 9.0\Reader\AcroRd32.exe";


    ProcessStartInfo newProcess = new ProcessStartInfo(pdfPrinterLocation, pdfArguments);
    newProcess.CreateNoWindow = true;
    newProcess.RedirectStandardOutput = true;
    newProcess.UseShellExecute = false;
    newProcess.RedirectStandardError = true;

    Process pdfProcess = new Process();
    pdfProcess.StartInfo = newProcess;
    pdfProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
    pdfProcess.Start();
    pdfProcess.WaitForExit();
}
Run Code Online (Sandbox Code Playgroud)

当我在Windows应用程序中实现它时,它可以工作,但是当我在Windows服务中实现它时,它不起作用.

你能帮助我吗?

c# visual-studio-2010

8
推荐指数
1
解决办法
1万
查看次数

密码必须至少有一个非alpha字符

我需要一个正则表达式的密码.密码必须至少包含8个字符.至少一个字符必须是数字或特殊字符(不是字母).

[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 8)]
[RegularExpression(@"(?=.*\W)?(?=.*\d)", ErrorMessage = "Error message")]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
Run Code Online (Sandbox Code Playgroud)

我有一个长度验证,但我需要一个正则表达式的帮助,检查密码是否包含至少一个数字或特殊字符.

有效密码的示例:

testtest85*
testtes*
testtes1
test1234*+
Run Code Online (Sandbox Code Playgroud)

无效密码的示例:

testtest
testabc
Run Code Online (Sandbox Code Playgroud)

c# regex validation asp.net-mvc

7
推荐指数
1
解决办法
11万
查看次数

您如何从Windows服务读取控制台输出?

我有控制台应用程序ThirdPartyApplications.exe,必须从Windows服务运行。控制台应用程序给我带来了休息:确定,不确定和错误。

我需要在Windows服务中捕获这些响应。

我创建了功能

 using (var p = new System.Diagnostics.Process())
        {
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.FileName = @"C:\ThirdPartyApplications.exe";
            p.StartInfo.Arguments = "3";
            p.Start();
            string o = p.StandardOutput.ReadToEnd();

            p.WaitForExit();
        }
Run Code Online (Sandbox Code Playgroud)

如何捕获此输出?

编辑

 using (var p = new System.Diagnostics.Process())
        {
            p.StartInfo.UseShellExecute = false;
            p.StartInfo.RedirectStandardOutput = true;
            p.StartInfo.FileName = @"C:\ThirdPartyBatch.bat";
            p.StartInfo.Arguments = "file.zip -user.properties";
            p.Start();
            string o = p.StandardOutput.ReadToEnd();

            p.WaitForExit();
        }
Run Code Online (Sandbox Code Playgroud)

批处理文件为

@echo off
call run.bat %* 1>log\out.txt 2>log\err.txt
@echo code %ERRORLEVEL%
exit /B %ERRORLEVEL%
Run Code Online (Sandbox Code Playgroud)

在这里,在我的变量o中,我没有收到消息“代码10”

如果我有

@ECHO off
ECHO Hello
PAUSE
Run Code Online (Sandbox Code Playgroud)

在这里,我收到消息“你好”,但是如果我更改批处理文件 …

windows-services console-application c#-4.0

5
推荐指数
1
解决办法
3987
查看次数