小编J4N*_*J4N的帖子

如何“减少”Jenkins Pipeline 输出路径

直到最近,我们才在 Jenkins 中构建没有任何“管道”的解决方案,所以我目前正在将我们的构建移动到多分支管道。

我遇到的问题是我们的解决方案有很多结构(很多子文件夹,有时还有一些大牌)。

目前,詹金斯管道提取文件夹中的所有内容,如下所示:

D:\ws\ght-build_feature_pipelines-TMQ33LB5OQIQ5VXVMFKFDG2HWCD4MUOGEGUWJUOMZ5D2GI42BIQA

这是很长的,现在我们达到了 260 个字符的限制MSBuild

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2991,5):错误 MSB3553:资源文件“obj\Release\xx.aaaaaaaaaa。 yyy.bbbbbb.dddddddddddddd.yyyyyyy.vvv.dddddddddd.Resources.resources”的名称无效。项目元数据“%(FullPath)”不能应用于路径“obj\Release\xx.aaaaaaaaaa.yyy.bbbbbb.dddddddddddddd.yyyyyyy.vvv.dddddddddd.Resources.resources”。指定的路径、文件名或两者都太长。完全限定的文件名必须少于 260 个字符,目录名必须少于 248 个字符。[D:\ws\ght-build_feature_pipelines-TMQ33LB5OQIQ5VXVMFKFDG2HWCD4MUOGEGUWJUOMZ5D2GI42BIQA\Src\bbbbbb\dddddd\dddddddddddddd\yyyyyyy\xx.adaddadddddbbbb.ydyddddddbbbb.

我们有太多长度很大的情况,以至于重构所有内容确实是一项艰巨的工作,所以我正在研究如何为 jenkins 指定一条更小的路径?

jenkins jenkins-pipeline

6
推荐指数
2
解决办法
2604
查看次数

如何使用 Nunit 运行程序查找“卸载应用程序域时遇到异常”的来源?

我们在不同的程序集中进行了大量测试(6000+)。我们使用 Nunit 测试适配器在本地 Azure 代理上运行它们。

这花了很长时间,所以我们激活了 runInParallel。

yaml 步骤现在如下:

  - task: VSTest@2
    timeoutInMinutes: 300
    inputs:
      testSelector: 'testAssemblies'
      testAssemblyVer2: '*.Test*.dll'
      searchFolder: '$(System.DefaultWorkingDirectory)/$(buildConfiguration)'
      codeCoverageEnabled: false
      platform: 'Any CPU'
      uiTests: false
      configuration: '$(buildConfiguration)'
      rerunFailedTests: false
      pathtoCustomTestAdapters: 'Solution/packages/NUnit3TestAdapter.3.12.0/build/net35'
      minimumExpectedTests: 1000
      runInParallel: true
      distributionBatchType: basedOnAssembly
      failOnMinTestsNotRun: true
      resultsFolder: 'testResults'
      runSettingsFile: '$(Build.SourcesDirectory)\azure-tests.runsettings'
    #continueOnError: true
Run Code Online (Sandbox Code Playgroud)

现在,我们得到了一些未通过的测试。我分析了其中一个,基本上,它失败了,因为在某些时候,它执行了OfType<SomeInterface>. 集合中的对象确实实现了这个接口,所以我想我一定有这个程序集加载两次的问题,并且这个接口不被认为与创建的对象相同。

当我检查日志时,我现在看到了这一点,这似乎证实了这个理论:

##[warning]RunMessage : Exception NUnit.Engine.NUnitEngineUnloadException,    Exception thrown unloading tests from C:\DevOp\2\s\debug\Acceptance.Tests.dll
##[warning]RunMessage : Exception encountered unloading application domain
##[warning]RunMessage :    at NUnit.Engine.Services.DomainManager.DomainUnloader.Unload()
   at NUnit.Engine.Runners.TestDomainRunner.UnloadPackage()
   at NUnit.Engine.Runners.AbstractTestRunner.Dispose(Boolean disposing)
   at …
Run Code Online (Sandbox Code Playgroud)

c# nunit nunit-3.0

6
推荐指数
0
解决办法
1396
查看次数

“Azure Web 应用程序”和“Azure 应用程序服务”有什么区别?

我对 Azure 很陌生,试图学习如何探索在 azure 上发布网站的可能性,以便更轻松地做 AZ-204。

在 azure 仪表板上,我可以创建“Azure Web 应用程序”、“Azure 应用程序服务”(更不用说 CI/CD 和无服务器)。 在此处输入图片说明

两者有什么区别?我最初教过 azure web 应用程序是代码驱动的(连接到 git),而“应用程序服务”是基于 docker 的。

但是对于这两个选项,当您进入下一步时,您可以选择是发布代码还是发布 docker 容器:

在此处输入图片说明

有人可以解释一下两者之间的区别吗?和/或一个比另一个最重要的优势?

我已经搜索了一段时间,但每次都不是相同的产品名称,而且我非常确定它仍然是相同的产品。

azure azure-web-app-service azure-webapps

6
推荐指数
2
解决办法
1609
查看次数

WPF DataGrid:指定默认排序

我有一个UserControl,它基本上只包含一个DataGrid。在此DataGrid中,我有一个事件列表(严重性-日期-消息)。用户控制是通过结合ViewModelLocatorMVVMLight Toolkit

我添加了两件事:

在我的UserControl资源中:

<UserControl.Resources>
    <CollectionViewSource x:Key="SortedEvents" Source="{Binding Events}">
        <CollectionViewSource.SortDescriptions>
            <componentModel:SortDescription PropertyName="EventTime" Direction="Descending"/>
        </CollectionViewSource.SortDescriptions>
    </CollectionViewSource>
</UserControl.Resources>
Run Code Online (Sandbox Code Playgroud)

由DataGrid使用:

<DataGrid ItemsSource="{Binding Source={StaticResource SortedEvents}}" AutoGenerateColumns="False" >
Run Code Online (Sandbox Code Playgroud)

我也有SortedDirection设置DataGridTextColumn.SortDirection

<DataGridTextColumn Binding="{Binding EventTime}"  Header="Time" IsReadOnly="True" SortDirection="Descending"/>
Run Code Online (Sandbox Code Playgroud)

当我检查设计器时,我看到一个小箭头,表明DataGrid已正确排序。

但是,当我启动该应用程序时,列表未排序,箭头不在此处。如果我单击该列以对其进行排序,那么它将对所有内容正确地进行排序,只是默认值似乎无效。

我想念什么?(这个dataGrid / column甚至都没有命名,因此我无法尝试通过其他方式对其进行编辑)。

(最初,我只在SortDirection上使用DataGridTextColumn。结果相同)

c# sorting wpf datagrid

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

处理ViewModel的模式?

我们与Prism一起启动了WPF项目,但我遇到了一个问题:

有时,在ViewModel中,我们注册了一些事件或已启动的服务,这些事件或服务在关闭前必须停止。这意味着,当我关闭应用程序时,我需要释放在ViewModel中获取的资源。这样,Dispose将会具有很多意义。

目前,我正在使用ViewModelLocator.Autowire = TruePrism,并且我在考虑不再需要View时,将在需要时将其处置。

我有两种情况:

  • 当我“导航”到视图时(RegionManager.RequestNavigate("RegionName", "RegionUri")
  • 当我在视图中使用“子视图”(这是一个具有自己的ViewModel的UserControl)时

我的问题是:处置那些ViewModel的正确方法是什么?我可以看到多种方法,但是我不确定哪一种是正确的。

c# wpf prism mvvm prism-6

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

无法从 Angular 12 升级到 Angular 13

我有一个 Angular 12 应用程序,我正在尝试将其升级到 Angular 13。

\n

根据https://update.angular.io/?l=2&v=12.0-13.0我应该运行:

\n
npx @angular/cli@13 update @angular/core@13 @angular/cli@13\n
Run Code Online (Sandbox Code Playgroud)\n

但是当我这样做时,我收到以下错误:

\n
npx @angular/cli@13 update @angular/core@13 @angular/cli@13\nThe installed local Angular CLI version is older than the latest stable version.\nInstalling a temporary version to perform the update.\n\xe2\x9c\x94 Package successfully installed.\nUsing package manager: \'npm\'\nCollecting installed dependencies...\nFound 38 dependencies.\nFetching dependency metadata from registry...\n    Updating package.json with dependency @angular-devkit/build-angular @ "13.0.2" (was "12.1.1")...\n    Updating package.json with dependency @angular/cli @ "13.0.2" (was "12.1.1")...\n    Updating package.json with dependency @angular/compiler-cli …
Run Code Online (Sandbox Code Playgroud)

angular-upgrade angular

5
推荐指数
2
解决办法
8350
查看次数

Azure Devop Test主动测试运行已中止。原因:测试主机进程崩溃:未处理的异常

我们有一个 PR 由于我们的测试集而失败了。他们仅因此 PR 而失败,并出现以下错误:

The active test run was aborted. Reason: Test host process crashed : Unhandled Exception: System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.
Run Code Online (Sandbox Code Playgroud)

它总是因这个错误而崩溃,而其他分支工作正常。总是相同的例外,但并非每次都在同一位置。我们尝试启用诊断,但它绝对没有提供任何附加信息:

##[debug]ProxyRunRequest: HandleLogMessage Entered
##[error]RunMessage : The active test run was aborted. Reason: Test host process crashed : Unhandled Exception: System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.
##[debug]Processed: ##vso[task.logissue type=error;]RunMessage : The active test run was aborted. Reason: Test host process crashed : Unhandled Exception: System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.
Run Code Online (Sandbox Code Playgroud)

我们使用Nunit,我们的YML的测试部分如下:

  - …
Run Code Online (Sandbox Code Playgroud)

testing nunit azure-devops

5
推荐指数
0
解决办法
2910
查看次数

mongoDb数据库如何尊重清洁代码架构?

我正在设置一个 C# Asp.Net Core Api,它将在未来大幅增长。因此,我试图尊重干净代码架构,以我的域为中心,没有任何依赖性和周围的一切:

public abstract class Entity
{
    public Guid Id { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我目前正在实施存储库。我的问题是,对于 mongoDb,似乎必须提供属性[BsonId],或者在我的实体中使用 BsonId。但这意味着在我的实体项目中添加 mongoDb 引用,我不是它的忠实粉丝。

public interface IRepository<TDocument> where TDocument : Entity
{
    IQueryable<TDocument> AsQueryable();
    IEnumerable<TDocument> FilterBy(
        Expression<Func<TDocument, bool>> filterExpression);
    IEnumerable<TProjected> FilterBy<TProjected>(
        Expression<Func<TDocument, bool>> filterExpression,
        Expression<Func<TDocument, TProjected>> projectionExpression);
    Task<TDocument> FindOne(Expression<Func<TDocument, bool>> filterExpression);

    Task<TDocument> FindById(Guid id);
    Task InsertOne(TDocument document);
    Task InsertMany(ICollection<TDocument> documents);
    Task ReplaceOne(TDocument document);
    Task DeleteOne(Expression<Func<TDocument, bool>> filterExpression);
    Task DeleteById(Guid id);
    Task DeleteMany(Expression<Func<TDocument, bool>> filterExpression);
}
Run Code Online (Sandbox Code Playgroud)

在我在 Clean Architecture 上找到的示例中,他们大多使用实体框架,不需要绝对属性即可工作。 …

c# repository-pattern mongodb .net-core clean-architecture

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

如何防止带有“console.log”的文件被提交?

我目前正在尝试强制我或我的同事无法在我的角度应用程序中提交包含 console.log 的文件。

我目前已经进行了husky预提交,执行ng lint --fix.

有没有办法在我的 linting 中添加一些内容以防止控制台日志,或者在 husky 脚本中添加一些内容?

人们仍然应该能够使用 console.log,只是不提交它。

谢谢

git pre-commit-hook eslint husky

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

如何在 pinia 商店内使用 vue-router?

我正在实现一个身份验证存储(带有 firebase),并根据身份验证将我的用户路由到登录/记录页面。

我基本上试图完成此任务:https://github.com/dannyconnell/vue-composition-api-course/blob/module-23/vue-composition-api-noteballs/src/stores/storeAuth.js

但在打字稿中。

在我的 中main.ts,我确实将商店声明为财产:

const app = createApp(App);
const pinia = createPinia();
pinia.use(({ store }) => {
  store.router = markRaw(router);
});
app.use(pinia);
app.use(router);
app.mount('#app');
Run Code Online (Sandbox Code Playgroud)

但是,在我的商店中,它仍然不知道我有一个路由器属性:

export const useStoreAuth = defineStore('storeAuth', {
    state: () => {
      return {
        user: {},
      } as AuthState;
    },
    actions: {
      init() {
        onAuthStateChanged(auth, user => {
          if (user && user.uid && user.email) {
            this.user = { id: user.uid, email: user.email };
            this.router.push('/'); //--> router doesn't exists
          } else {
            this.user …
Run Code Online (Sandbox Code Playgroud)

typescript vue.js vue-router vuejs3 pinia

5
推荐指数
2
解决办法
4579
查看次数