我有一个asp.net核心项目,可以使用VS正确构建,但不会在msbuild下构建.
它没有找到所有常见的库(系统等)
我正在使用teamcity,部分构建过程是一个nuget恢复.
我尝试执行与teamcity相同的步骤,但是手动使用msbuild,它失败了,没有找到libs.
我添加了一个dotnet还原步骤然后它工作了.
那么,nuget还原和dotnet还原之间有什么区别?
有没有办法在使用 docker-compose 时设置堆栈名称?
目前它采用文件夹名称(这是一个可怕的区域),这会导致一些混乱。
例如,我们有几个项目有一个包含数据库堆栈的数据库文件夹。在单个主机上运行这些时,我们现在有几个数据库堆栈。
我们与MongoDB一起使用的每个项目都会在没有加载的System.Runtime.InteropServices库中出现问题.
这次错误很有趣:
外部异常找不到lib的4.3.0.0版本.但是内部异常找不到版本4.0.0.0
有没有人对此有所了解?
有关此问题的更多信息:
所以,NuGet已经安装了4.3.0.0
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Runtime" version="4.3.0" targetFramework="net462" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net462" />
</packages>
Run Code Online (Sandbox Code Playgroud)
packages.config确认我已经安装了4.3.0.0,
然而,app.config似乎总是与现实不同步:
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)
添加了关于版本4.0.1.0的一行
在同一行.. csproj是胡说八道:
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>x:\Packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
Run Code Online (Sandbox Code Playgroud)
因为它声称引用4.0.1.0的路径为4.3.0.0
有一些东西被破坏了,它总是发生在那个完全相同的lib上; 不仅仅是这个项目:在我包含MongoDB的任何地方,这个lib都是一个依赖项,每次都有一些随机问题.
当我尝试手动加载时:
var Name = new AssemblyName("System.Runtime.InteropServices.RuntimeInformation, Version=4.3.0.0");
var Asm = Assembly.Load(Name);
Run Code Online (Sandbox Code Playgroud)
它也失败了.
我发现System.Runtime.InteropServices.RuntimeInformation.dll不会被复制到build文件夹,即使它包含在项目中.
我找到了一个讨厌的解决方法:如果我在主exe中包含MongoDB,即使我不使用它,它依赖于Interop lib,这迫使lib被复制到build文件夹,然后后续调用工作.
我在每个应用程序启动时都有这个。
有谁知道这是从哪里来的?
信息:Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0] 用户配置文件可用。使用“/Users/thomas/.aspnet/DataProtection-Keys”作为密钥库;密钥不会被静态加密。
// run the web host
var PathToContentRoot = Directory.GetCurrentDirectory();
var Host = WebHost.CreateDefaultBuilder()
.UseKestrel()
.UseContentRoot(PathToContentRoot)
.UseStartup<WebStartup>()
.UseNLog()
.Build();
Run Code Online (Sandbox Code Playgroud)
我对“数据保护”、“密钥”等一无所知,也不想要任何形式的安全功能。
ConfigureServices 部分的代码是:
// find all controllers
var Controllers =
from a in AppDomain.CurrentDomain.GetAssemblies().AsParallel()
from t in a.GetTypes()
let attributes = t.GetCustomAttributes(typeof(ControllerAttribute), true)
where attributes?.Length > 0
select new { Type = t };
var ControllersList = Controllers.ToList();
Logging.Info($"Found {ControllersList.Count} controllers");
// register them
foreach (var Controller in ControllersList)
{
Logging.Info($"[Controller] Registering {Controller.Type.Name}");
Services
.AddMvc()
.AddJsonOptions(Options => Options.SerializerSettings.ContractResolver …
Run Code Online (Sandbox Code Playgroud) 我有几个系统使用 docker-compose 并且没有问题。
然而,我这里有一个“down”根本不起作用的地方。不过“向上”效果很好。这是在 MacOS 上。
该项目的昵称是“stormy”,脚本如下:
version: '3.3'
services:
rabbitmq:
container_name: stormy_rabbitmq
image: rabbitmq:management-alpine
restart: unless-stopped
ports:
- 5672:5672
- 15672:15672
expose:
- 5672
volumes:
#- /appdata/stormy/rabbitmq/etc/:/etc/rabbitmq/
- /appdata/stormy/rabbitmq/data/:/var/lib/rabbitmq/
- /appdata/stormy/rabbitmq/logs/:/var/log/rabbitmq/
networks:
- default
settings:
container_name: stormy_settings
image: registry.gitlab.com/robinhoodcrypto/stormy/settings:latest
restart: unless-stopped
volumes:
- /appdata/stormy/settings:/appdata/stormy/settings
external_links:
- stormy_rabbitmq:rabbitmq
networks:
- default
capture:
container_name: stormy_capture
image: registry.gitlab.com/robinhoodcrypto/stormy/capture:latest
restart: unless-stopped
volumes:
- /appdata/stormy/capture:/appdata/stormy/capture
external_links:
- stormy_rabbitmq:rabbitmq
networks:
- default
livestream:
container_name: stormy_livestream
image: registry.gitlab.com/robinhoodcrypto/stormy/livestream:latest
restart: unless-stopped
volumes:
- /appdata/stormy/capture:/appdata/stormy/livestream
external_links:
- stormy_rabbitmq:rabbitmq …
Run Code Online (Sandbox Code Playgroud) 我有一个以这种方式绘制子图的绘图:
fig = make_subplots(
rows=4,
cols=1,
subplot_titles=("Price, orders and positions", "Margin use", "PnL and fees", "Volume traded"),
row_heights=[0.5, 0.2, 0.2, 0.1],
vertical_spacing=0.1
)
# price, orders, etc
fig.add_traces(
[
# draw price, average price and min / max
go.Scatter(name='Price', x=df.index, y=df['price'], mode='lines', line=dict(color='rgba(31, 119, 180, 1.)')),
go.Scatter(name='Average Price', x=df.index, y=df['average_price'], mode='lines', line=dict(color='rgba(31, 119, 180, 0.5)')),
go.Scatter(x=df.index, y=df['price_max'], mode='lines', marker=dict(color="#444"), line=dict(width=0), showlegend=False),
go.Scatter(x=df.index, y=df['price_min'], marker=dict(color="#444"), line=dict(width=0), mode='lines', fillcolor='rgba(68, 68, 68, 0.3)', fill='tonexty', showlegend=False),
# draw the long / short orders
go.Scatter(name='Long …
Run Code Online (Sandbox Code Playgroud) 我们有一个由一堆小工具组成的项目.
所有这些都使用MongoDB,并且没有其中一个没有使用该错误一次又一次地烦扰我:
发生System.IO.FileNotFoundException HResult = 0x80070002
消息=无法加载文件或程序集'System.Runtime.InteropServices.RuntimeInformation,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其依赖项之一.
并且他们都有一个app.config文件,我甚至不知道其来源与以下内容:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
</assemblyBinding>
Run Code Online (Sandbox Code Playgroud)
同时,NuGet有以下几行:
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net462" />
Run Code Online (Sandbox Code Playgroud)
所以,显然,我有Interop lib版本4.3.0,但有些文件我不知道想要版本4.0.1.0(请注意,甚至没有相同数字的数字).这通常是通过删除lib,重新添加它来修复的......很快,同样的问题将再次出现,通常是在一些NuGet更新之后,等等.
它似乎只发生在我们有MongoDB库的项目中,其中NuGet中的版本号与创建app.config文件的版本号不同步.
我有以下内容,使用 plotly express:
fig = px.line(series1, x='timestamp', y='data')
fig.show()
Run Code Online (Sandbox Code Playgroud)
它工作正常。
我想一起制作多个图,所以我做了:
fig = make_subplots(rows=2, cols=1)
fig.add_trace(px.line(series1, x='timestamp', y='data'), row=1, col=1)
fig.add_trace(px.line(series2, x='timestamp', y='data'), row=1, col=1)
fig.add_trace(px.line(series2, x='timestamp', y='data'), row=2, col=1)
fig.show()
Run Code Online (Sandbox Code Playgroud)
但我得到:
为无效元素的 'data' 属性接收到的无效元素包括:[Figure({ 'data': [{'hoverlabel': {'namelength': 0},
虽然,
fig = make_subplots(rows=1, cols=2)
fig.add_trace(go.Scatter(x=series1['timestamp'], y=series1['data']), row=1, col=1)
fig.add_trace(go.Scatter(x=series2['timestamp'], y=series2['data']), row=1, col=1)
fig.add_trace(go.Scatter(x=series2['timestamp'], y=series2['data']), row=1, col=2)
fig.show()
Run Code Online (Sandbox Code Playgroud)
将工作; 所以看起来 plotly express 不适用于子图。
我错过了什么吗?
另外,作为一个额外的问题:我还没有找到如何为每个跟踪指定颜色。
我有一个ID列表
List<string> Ids;
Run Code Online (Sandbox Code Playgroud)
我想检索匹配这些ID的所有文件.
网上有解决方案:
var ids = new int[] {1, 2, 3, 4, 5};
var query = Query.In("name", BsonArray.Create(ids));
var items = collection.Find(query);
Run Code Online (Sandbox Code Playgroud)
但他们都使用旧的C#驱动程序和(不再那么新)2.2.4驱动程序API已更改,我无法找到如何构建此查询.
我正在使用Insomnia来测试API,但Postman也是如此.
我想用以下控制器测试文件上传:
public async Task<IActionResult> Post([FromForm]IFormFile File)
Run Code Online (Sandbox Code Playgroud)
如果我将请求设置为多部分请求:
有用.
但是,如果我将其设置为二进制文件:
我不知道如何获取数据.怎么做到呢?
另外,在控制器方法的签名中,如果我将[FromForm]更改为[FromBody],我就不会获取数据.
有人可以为我澄清一下吗?