在我的 C# 项目中,我引用了我公司的一个 DLL,该 DLL 不在 NuGet 上(因为它不是公开的),而我在 Azure DevOps 中的管道不断失败,因为它表示找不到引用。
Error CS0234: The type or namespace name 'YYY' does not exist in the namespace 'ZZZ' (are you missing an assembly reference?)
Run Code Online (Sandbox Code Playgroud)
按照这篇文章的建议,我在解决方案中复制了该 dll,并从那里引用它,因此该 dll 受到版本控制并存在于存储库中。这是 csproj 的摘录:
<Reference Include="ZZZ.YYY, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\PrivateReferences\ZZZ.YYY.dll</HintPath>
<Private>False</Private>
</Reference>
Run Code Online (Sandbox Code Playgroud)
该解决方案在我的机器上完美构建,但在 Azure 上却一直失败。我缺少什么?
谢谢!
在 Bright Ran-MSFT 回复后进行编辑
以下是我的 yaml 中的摘录:
trigger:
- develop
pool: 'Default'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Debug'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs: …Run Code Online (Sandbox Code Playgroud) 我正在使用 Newtonsoft 翻译显示日期的 JSON 字符串
"[{\"Name\":\"Learning\",\"Start Date\":\"2022-03-01\",\"End Date\":\"2022-04-30\"]"
Run Code Online (Sandbox Code Playgroud)
我想将其反序列化为这个自定义对象
public class MyObject
{
public string Name { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
通过做这个
var myObject = JsonConvert.DeserializeObject<List<MyObject>>(jsonRecords,
new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd" });
Run Code Online (Sandbox Code Playgroud)
但是 StartDate 和 EndDate 对象始终显示为 01/01/0001,而我希望它们以这种格式显示:dd/MM/yyyy
我也尝试过使用,new IsoDateTimeConverter { DateTimeFormat = "dd/MM/yyyy" }但这也不起作用(我认为你需要使用日期来自 json 的格式?)
我究竟做错了什么?