小编Mat*_*tze的帖子

Azure Devops 中是否有 $(SourceVersion) 的 7 位简短版本?

我正在尝试将我们的构建名称设置为...

$(BuildDefinitionName)_$(versionMajor).$(versionMinor).$(versionPatch)+$(SourceBranchName).$(SourceVersion) 例如 OurBigLibraryCI_1.2.3+master.10bbc577

但是我找不到任何包含提交哈希的“短”(7 位)版本的预定义变量。$(SourceVersion)保存完整的 SHA-1 哈希值。

如何在基于 yaml 的管道中缩短它?

yaml azure-devops

16
推荐指数
3
解决办法
5459
查看次数

Swashbuckle招摇是行不通的

我有一个web api 2项目.它被配置为使用owin自托管.它没有任何global.asax文件.我需要有关于web api的帮助页面,并且已经使用了swaschbuckle.但是rooturl/swagger/docs没有提供任何输出.我按照这里的说明' https://github.com/domaindrivendev/Swashbuckle/issues/196 ',但它仍然无法正常工作.以下是我的配置代码

public void Configuration(IAppBuilder app)
{
    // Configure DI
    container = BuildDI();

    // Create the configuration. OWIN Should create a new httpconfiguration.
    // GlobalConfiguration can't be used.
    HttpConfiguration = new HttpConfiguration();

    HttpConfiguration.Formatters.XmlFormatter.UseXmlSerializer = true;
    HttpConfiguration.MapHttpAttributeRoutes();
    HttpConfiguration.DependencyResolver = new AutofacWebApiDependencyResolver(container);

    // Set ServicePointManager properties.
    ServicePointManager.ServerCertificateValidationCallback = ((sender, cert, chain, sslPolicyErrors) => true);

    // 10 concurrent connections can be made on the service point.
    ServicePointManager.DefaultConnectionLimit = 10;

    // After the idle time expires, the ServicePoint object is …
Run Code Online (Sandbox Code Playgroud)

c# swagger asp.net-web-api2 swashbuckle

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

Visual Studio 2019:出现错误弹出窗口:“为了防止在评估函数时发生不安全的中止...”

在启动 ASP.NET Core 3 WebApi 项目时,我遇到了 Visual Studio 2019(版本 16.3.8)的问题。

单击确定后,项目启动并运行,没有任何问题。然而,每次我开始我的解决方案时,弹出窗口都会不断地唠叨我。

  1. 我怎样才能停止显示它?
  2. 它到底想告诉我什么?

在此处输入图片说明

visual-studio-2019 asp.net-core-3.0

8
推荐指数
2
解决办法
4399
查看次数

如何捕获 ExtendedSocketException?

这可能听起来很愚蠢,但我就是抓不到ExtendedSocketException被抛出的东西SocketTaskExtensions.ConnectAsync()

完整的命名空间是:System.Net.Internals.SocketExceptionFactory.ExtendedSocketException

编译器抱怨Cannot resolve symbol 'ExtendedSocketException'. 我的类库和测试项目都针对 .Net Core 2.1。

此外,也没有可以添加的此类参考或 Nuget 包。至少我找不到任何东西......而且https://learn.microsoft.com上似乎也没有任何东西......

我在这里做错了什么?

[Fact]
[Trait("Category", "UnitTest")]
public async Task Should_Throw_Exception_If_Port_Unreachable()
{
    // Arrange
    var client = new TcpConnector();
    var nonListeningPort = 81;
    var endpoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), nonListeningPort);

    // Act & Assert
    var connectTask = client.ConnectAsync(endpoint);
    Func<Task> func = async () => { await connectTask; };

    func.Should().Throw<ExtendedSocketException>();
}
Run Code Online (Sandbox Code Playgroud)

c# sockets exception .net-core

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

Android SDK 管理器抱怨“加载 SDK 组件信息失败”。

我想使用 Xamarin 和 Visual Studio 2017 Enterprise (15.8.4) 构建移动应用程序。因此,我遵循了微软关于安装整个堆栈的文档。Mobile Development with .NET从安装程序中选择工作负载,希望它能够引入所有必要的依赖项。

不幸的是,当我尝试从 Visual Studio 中启动 Android SDK Manager 时,我得到了Loading SDK component information failed. Please retry.

在此输入图像描述

根据文档,VS 安装程序应将 AndroidNDK 安装到C:\ProgramData\Microsoft\AndroidNDK64. 该文件夹可用,但为空。

C:\Microsoft\AndroidNDK64但是我发现我的文件系统上的文件夹包含android-ndk-r13bandroid-ndk-r15c。我尝试从 VS 指向这个目录之一,Tools -> Options -> Xamarin -> Android NDK Location但没有改变我前面提到的问题。

在此输入图像描述

安装了以下软件包:

部分模拟器:

  • Google Android 模拟器(API 级别 27)
  • Intel Hardware Accel Exec Manager (HAXM)(全局安装)

开发活动:

  • F# 语言支持
  • Xamarin
  • Xamarin 分析器
  • Xamarin 远程模拟器
  • Xamarin 工作簿 …

android xamarin visual-studio-2017

6
推荐指数
1
解决办法
4737
查看次数

在 Windows 上“安装”第三方库和头文件的位置?

在 Windows 上开发 C/C++ 时,您将第三方库和头文件存储在哪里?

在 Linux 上开发时,包管理器通常将第三方库安装到/usr/lib/usr/include. 所以我知道去哪里找。

我刚刚开始在 Windows 上开发,并且错误地安装了库,C:\Program Files由于 UAC 和 Windows 10 上的权限查找,这是一个坏主意。

是否有某种最佳实践?提前致谢

linux windows libraries

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

JetBrains.ReSharper.TaskRunnerFramework.dll中的'System.IO.EndOfStreamException'

当尝试在调试模式下运行非常基本的xunit测试时,我的测试项目抛出了一些异常,这些异常似乎来自ReSharper。

Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Could not find file 'C:\Temp\test\TestProjekt\TestProjekt\bin\Debug\TestProjekt.xunit.runner.json'.

Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Could not find file 'C:\Temp\test\TestProjekt\TestProjekt\bin\Debug\xunit.runner.json'.

Managed Debugging Assistant 'LoadFromContext' 
The assembly named 'xunit.runner.utility.net452' was loaded from 'file:///C:/Program Files (x86)/JetBrains/Installations/ReSharperPlatformVs15_0a4dd3ad/xunit.runner.utility.net452.dll' using the LoadFrom context. The use of this context can result in unexpected behavior for serialization, casting and dependency resolution. In almost all cases, it is recommended that the LoadFrom context be avoided. This can be done by installing assemblies in the Global Assembly Cache …
Run Code Online (Sandbox Code Playgroud)

c# resharper exception xunit

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

浏览器链接不刷新 Chrome 中的页面

我正在关注文档以启用浏览器链接并.NET Core 3使用提供的模板(运行 Visual Studio 16.3.9,这是撰写本文时的最新版本)设置新的 Blazor 项目(目标)。

在此处输入图片说明

正如文档中提到的,我已经安装了 nuget 包Microsoft.VisualStudio.Web.BrowserLink并将中间件添加到我的Startup.cs

public class Startup 

    // ...

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            app.UseBrowserLink();
        }

        // ...
Run Code Online (Sandbox Code Playgroud)

启动应用程序并打开时,Browser Link Dashboard我看到浏览器已连接:

在此处输入图片说明

但是,在进行更改(例如添加<Counter />到 )时Index.razor,更改不会反映在我的浏览器窗口中。

当我从 Visual Studio 中点击刷新按钮时,浏览器窗口似乎刷新了,但没有显示更改。这同样适用于使用浏览器刷新按钮手动刷新页面。

更有趣的是,当不在调试模式下运行时,刷新似乎有效。

我在这里做错了什么?

c# google-chrome blazor visual-studio-2019 asp.net-core-3.0

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

为什么 webpack-dev-server 不执行编译器钩子?

考虑以下webpack.config.js。运行时npx webpack我的调用console.log('Here goes my custom function')被执行。然而运行npx webpack-dev-server它并没有,尽管我可以看到它进行了编译。

这是为什么?我该如何解决这个问题?

module.exports = {
      // ... 
    module: {
      // ...
    plugins: [  
        {
            apply: (compiler) =>{
                compiler.hooks.beforeRun.tap('BeforeRunPlugin', (compilation) => {
                    console.log('Here goes my custom function')
                })
            }
        },
        // ... 
    ],
    devServer: {  
        contentBase: join(__dirname, 'dist'),
        publicPath: './assets/',
        port: 7700,
        open: false,
        overlay: true, // show compiler errors as overlay
        writeToDisk: true,
    }
};
Run Code Online (Sandbox Code Playgroud)

webpack webpack-dev-server webpack-4

4
推荐指数
1
解决办法
1863
查看次数

如何将 &lt;Card.Text&gt; 渲染为 &lt;div&gt; 元素而不是 &lt;p&gt; ?

因为<Card.Body>似乎有一个名为which 类型且默认为 的参数aselementType<div>

https://react-bootstrap.github.io/components/cards/#card-body-props

现在<Card.Text>默认会<p>在我的网站上产生警告,因为我<div>在其中嵌套了元素<Card.Text>

警告:validateDOMNesting(...):不能显示为<p>

所以基本上有两个问题:

  1. 如何更改/设置元素类型Card.Body?以下尝试没有反映在生成的 html 中(使用 Chrome DevTools 检查):<Card.Body as="p">...</Card.Body>这也没有<Card.Body as="<p>">...</Card.Body>

  2. 如何更改 上的元素类型<Card.Text>


这就是我的组件的样子

import React from "react"
import { Link } from "gatsby"
import Img from "gatsby-image"
import Card from "react-bootstrap/Card"
import Tags from "./tags"
import TimeToRead from "./time-to-read"

const Post = ({ title, slug, date, body, fluid, tags, timeToRead }) => { …
Run Code Online (Sandbox Code Playgroud)

reactjs react-bootstrap

4
推荐指数
1
解决办法
1400
查看次数