我们已经使用 Bamboo 构建服务器有一段时间了,并且安装了 GitVersion,因此可以将其选为构建计划中的任务。运行任务时,我们通常使用 /UpdateAssembleInfo 参数。对于.NET Framework项目,这将使用bamboo版本控制设置更新源中的程序集信息文件,以便.NET程序集具有与我们的Bamboo构建和后续Bamboo部署相同的版本信息,从而使我们能够了解已部署项目的版本通过检查程序集文件属性来确定该字段。这一切都运作得很好。
但是,我们现在正在构建和部署 .NET Core 2.0 解决方案,并发现 GitVersion /UpdateAssemblyInfo 不起作用。
我搜索了 .NET Core 的修复程序,但只能找到涉及使用 project.json 文件的解决方案,该文件不再与 .NET Core 2.0 一起使用(它更改为 *.csproj 文件)。
我查看了http://gitversion.readthedocs.io/en/latest/usage/command-line/我尝试运行
gitversion.exe /UpdateAssemblyInfo MyProjectName.AssemblyInfo.cs /EnsureAssemblyInfo
Run Code Online (Sandbox Code Playgroud)
其中 MyProjectName 表示 .NET Core 2.0 ..\\obj\release\netcoreapp2.0 文件夹中的 assemblyinfo.cs 文件的实际项目名称后缀。但它没有更新该文件。
我必须假设必须有一个将 GitVersion 与 Bamboo 和 .NET Core 2.0 一起使用的解决方案,但我很难找到一个解决方案。
有任何想法吗?
我在一个表格水平div中有一个输入组,它在大屏幕上看起来很棒.它在bootply中看起来也很棒,但每当我开始调整屏幕大小时,表单就会换行(这没关系)但输入组插件会从输入组中分离或分离.我尝试了很多css和样式的组合.
我该如何防止这种行为?
在大屏幕上:
在小屏幕上:
html:
<div class="row">
<div class="form-horizontal">
<div class="form-group form-group-justified" >
<label class="control-label col-md-2" for="Start">Start</label>
<div class="col-md-2">
<div class="input-group date">
<input value="24/07/14" class="form-control" />
<span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
</div>
<span class="field-validation-valid text-danger" data-valmsg-for="Start.Date" data-valmsg-replace="true"></span>
</div>
<div class="col-md-3">
<select class="form-control combo" data-val="true" data-val-required="The DaySelection field is required." id="Start_DaySelection" name="Start.DaySelection">
<option selected="selected">Full</option>
<option>HDBL</option>
<option>HDAL</option>
<option>Other</option>
</select>
</div>
<div class="col-md-4" style="display: none;">
<div class="col-md-6">
<input class="form-control" id="Start_From" name="Start.From" placeholder="From" type="text" value="" />
</div>
<div class="col-md-6">
<input class="form-control" id="Start_To" name="Start.To" …
Run Code Online (Sandbox Code Playgroud) 我想有一个函数,它采用字符串字典,变量数组.所以它可以用:
searchDictionary := TDictionary<string, array of variant>;
searchDictionary.Add('KEY_NAME', ['X01%', '%D01']);
aValue := TDtoClass.Search(searchDictionary)
Run Code Online (Sandbox Code Playgroud)
我目前正在实现这个目标
searchDictionary := TDictionary<string, TList<variant>>.Create;
searchDictionary.Add('BIN_NAME', TSearch.Values(['X01%', '%D01']));
Run Code Online (Sandbox Code Playgroud)
其中Tsearch是一个暴露的类:
class function TSearch.Values(const arguments: array of variant): TList<variant>;
var
list : TList<variant>;
item: variant;
begin
list := TList<variant>.Create;
for item in arguments do
begin
list.Add(item);
end;
Result := list;
end;
Run Code Online (Sandbox Code Playgroud)
我想做的是:
searchDictionary.Add('BIN_NAME', ['X01%', '%D01']);
Run Code Online (Sandbox Code Playgroud)
代替:
searchDictionary.Add('BIN_NAME', TSearch.Values(['X01%', '%D01']));
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
我在C#中有一个接口,如下所示:
public interface IMessageOptions
{
int ReceiveTimeout { get; set; }
int PeekTimeout { get; set; }
bool Transactional { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
而我正试图在F#中实现它,如下所示:
type Settings() =
interface IMessageOptions with
member this.PeekTimeout: int with get, set
member this.ReceiveTimeout: int with get, set // error at start of this line
member this.Transactional: bool with get, set
Run Code Online (Sandbox Code Playgroud)
但是在第一个属性说:
"模式中此点或之前的不完整结构化构造"
怎么写呢?
在此上下文中是否不允许使用自动属性?
我需要与一系列.Net Web服务进行交互.目前大约有150个.由于delphi 2010使用Thttprio来实现这一点,我试图在客户端创建一个通用代理,可以调用它来创建适当的soap服务客户端.有谁知道如何将httprio对象转换为通用接口类型?
谢谢
下面是我正在尝试使用的代理函数:
class function Web.Proxy<T>(svc: string): T;
var
HTTPRIO : THTTPRIO;
begin
HTTPRIO := THTTPRIO.Create(nil);
HTTPRIO.URL := GetServiceURL(svc);
Result:= HTTPRIO as T; //<-- Fails with "operator not applicable to this operand type"
// Result:= T(HTTPRIO); //<-- also fails, but with "invalid typecast"
end;
Run Code Online (Sandbox Code Playgroud)
我的想法是,我可以这样称呼:
Web.Proxy<AutmobileServiceSoap>('svc.asmx').GetAutomobile(125);
Run Code Online (Sandbox Code Playgroud)
WSDL导入的AutmobileServiceSoap定义如下:
AutmobileServiceSoap = interface(IInvokable)
Run Code Online (Sandbox Code Playgroud)
并且所有wsdl导入都有一个以类似方式返回httprio对象的函数:
function GetAutomobileServiceSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): AutomobileServiceSoap;
const
defWSDL = 'http://localhost:8732/Cars.Server/Data/AutomobileService.asmx?WSDL';
defURL = 'http://localhost:8732/Cars.Server/Data/AutomobileService.asmx';
defSvc = 'AutomobileService';
defPrt = 'AutomobileServiceSoap12';
var
RIO: THTTPRIO;
begin
Result := …
Run Code Online (Sandbox Code Playgroud) 如果字符串前面没有问号,我怎么能写一个正则表达式模式来按特定的分隔符分割字符串?
我编写了一个解析器,将EDIFACT消息拆分为段,复合和元素.但在EDI标准中,问号是逃避字符.所以要拆分这个字符串:
'PRI+2.005:1+9022.5'RAD+RRHANB97+120814'
Run Code Online (Sandbox Code Playgroud)
我可以使用string.Split( '\' '),然后string.split(' + '),然后string.split(':'),以获得PRI,2.005,1,9022.5等等.然而,这些字符被问号逃脱:
'PRI+2.005?+3.2:1+9022.5'RAD?'R+RRHANB97+120814'
Run Code Online (Sandbox Code Playgroud)
现在应该是PRI,2.005 + 3.2,1,9022.5,RAD'R,RRHANB97.
有人可以帮助正则表达式匹配'而不是?'?
谢谢
我已成功使用Delphi 2010来发出http get请求,但对于一个需要名为'xml'的参数的服务,请求失败并出现'HTTP/1.1 400 Bad Request'错误.
我注意到调用相同的服务并省略'xml'参数有效.
我试过以下但没有成功:
HttpGet('http://localhost/Service/Messaging.svc/SendReports/PDF?xml=<?xml version="1.0"?><email><message><to>email@internal.com</to><from>from@internal.com</from></message></email>&id=42&profile=A1');
Run Code Online (Sandbox Code Playgroud)
...
function TReportingFrame.HttpGet(const url: string): string;
var
responseStream : TMemoryStream;
html: string;
HTTP: TIdHTTP;
begin
try
try
responseStream := TMemoryStream.Create;
HTTP := TIdHTTP.Create(nil);
HTTP.OnWork:= HttpWork;
HTTP.Request.ContentType := 'text/xml; charset=utf-8';
HTTP.Request.ContentEncoding := 'utf-8';
HTTP.HTTPOptions := [hoForceEncodeParams];
HTTP.Request.CharSet := 'utf-8';
HTTP.Get(url, responseStream);
SetString(html, PAnsiChar(responseStream.Memory), responseStream.Size);
result := html;
except
on E: Exception do
Global.LogError(E, 'ProcessHttpRequest');
end;
finally
try
HTTP.Disconnect;
except
end;
end;
end;
Run Code Online (Sandbox Code Playgroud)
使用参数名称'xml'调用相同的url重命名为其他任何内容,例如'xml2'或'name',其值与上面相同也可以.我也尝试了charset的多种组合,但我认为indy组件正在内部更改它.
编辑
该服务预计:
[WebGet(UriTemplate = "SendReports/{format=pdf}?report={reportFile}¶ms={jsonParams}&xml={xmlFile}&profile={profile}&id={id}")]
Run Code Online (Sandbox Code Playgroud)
有没有人有这方面的经验?
谢谢
我开发了一个外部WPF应用程序来生成c#中的绘图.我已经能够使用Autodesk.AutoCAD.Interop绘制,维度,添加块以及应用程序所需的所有其他内容,但是我似乎无法填充标题块或生成部件列表.
我见过的所有示例都基于要求应用程序作为AutoCAD内部插件运行的机制.事实是,使用ModelSpace.InsertLine插入一行使用的是一行或两行代码,现在,它至少有8行代码!
有没有办法使用Autodesk.AutoCAD.Interop实现此功能?或者有没有办法将interop与可以从外部exe调用的插件结合使用?
任何关于此的指示将不胜感激.
谢谢.
编辑 说明:
// before - Draw Line with Autodesk.AutoCAD.Interop
private static AcadLine DrawLine(double[] startPoint, double[] endPoint)
{
AcadLine line = ThisDrawing.ModelSpace.AddLine(startPoint, endPoint);
return line;
}
// Now - Draw line with Autodesk.AutoCAD.Runtime
[CommandMethod("DrawLine")]
public static Line DrawLine(Coordinate start, Coordinate end)
{
// Get the current document and database
// Get the current document and database
Document acDoc = Application.DocumentManager.MdiActiveDocument;
Database acCurDb = acDoc.Database;
// Start a transaction
using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
{
// Open …
Run Code Online (Sandbox Code Playgroud) I have written a logging framework that uses Log4Net, Nlog and Serilog interchangeably. Every call to the logger, fires an event before the log entry is written. This optionally pushes entries via SignalR to connected web clients.
在添加serilog之前,我使用string.Format获取格式化的文本。如今,巨大的破坏带来了巨大的责任。string.Format显然不喜欢字符串中的{@ 0}或{data}。
// log the event before engaging with the logger
LogEventBus.Handle(LogLevels.Info, DateTime.Now, msg, args);
if (DiagnosticLevel < level)
return;
_logger.Info(msg, args);
Run Code Online (Sandbox Code Playgroud)
有什么方法可以直接以字符串形式获取serilog生成的输出?
我开始写一个内存接收器,但是它脱离了基于集中事件的日志记录,并且完全脱离了我已经实现的其他库。
有什么建议么?
我有一个方法可以返回我试图在 F# 中同步测试的任务。这是方法,它是 C# 接口的实现:
member this.RunAsync(): System.Threading.Tasks.Task =
async{
this._settings.LogSettings |> Seq.iter(fun settings -> this.clearLogs(settings)) |> ignore
return ()
} |> Async.StartAsTask :> _
Run Code Online (Sandbox Code Playgroud)
这是我的测试逻辑
Async.AwaitTask(logFileManager.RunAsync())|> Async.Ignore
// and I've tried
async {
logFileManager.RunAsync()
Assert.Pass()
} |> Async.RunSynchronously
Run Code Online (Sandbox Code Playgroud)
测试运行,有 5 个项目,预期的调用次数应该是 5,但测试失败,调用次数在 1 到 2 之间。
在 C# 中对另一个实现的相同测试很简单:
[Test]
public async Task Should_do_something_in_an_asynchronous_method()
{
var unitUnderTest = GetService();
await unitUnderTest.RunAsync();
}
Run Code Online (Sandbox Code Playgroud)
如何确保完成单元测试的任务?
如何编写等效的测试方法async
?
是否可以在运行时从包含的CodeSite express获取异常的堆栈跟踪?如果是这样,有没有人有这方面的经验或实例?
如果失败了,有没有办法通过开源库实现这一目标?
我将日志记录引入了一个已有10年历史的Delphi应用程序,因此在没有日志记录的情况下,仍有相当大比例的应用程序.因此,对于尚未重写的区域,我有一个Application.OnException挂钩.对我们在生产中获得的零星访问冲突进行有意义的堆栈跟踪将非常有用.下面是我已经拥有的,我很失望地发现StackTrace属性为空.
class procedure Log.Error(const err: Exception; const method: string);
begin
FileLog(err, method);
end;
class procedure Log.FileLog(const err: Exception; const method: string);
var
_msg: TStringList;
begin
//_msg := Format('%s Failed:%3:s%1:s%3:s %2:s%3:s', [PreparedEntry(method), err.Message, err.StackTrace, sLineBreak]);
_msg := PreparedEntry( Format('%s Failed:', [method]));
_msg.Add(err.Message);
_msg.Add(err.StackTrace);
WriteLog(_msg, _logFileName);
end;
Run Code Online (Sandbox Code Playgroud)
我们正处于从delphi win32应用程序迁移到仍然为delphi客户端应用程序提供服务的多层.net wcf服务器应用程序的高级阶段.长期和短期是在说服管理层购买Delphi XE5(只是为了获得改进的json支持和实时绑定)之后,要求购买另一个delphi是非常难以证明的.
谢谢
delphi ×4
c# ×3
delphi-2010 ×3
f# ×2
logging ×2
.net ×1
asp.net ×1
asp.net-core ×1
asp.net-mvc ×1
asynchronous ×1
autocad ×1
bamboo ×1
codesite ×1
css ×1
delphi-xe5 ×1
edi ×1
edifact ×1
exception ×1
generics ×1
gitversion ×1
html ×1
http ×1
indy ×1
nunit ×1
regex ×1
serilog ×1
unit-testing ×1