Project builds but can't publish

前端 未结 12 1757
萌比男神i
萌比男神i 2020-11-29 04:03

I have an MVC project that for an uknown reason refuses to publish to a local folder in the PC.

The log says the following:

3>------ Publish start         


        
12条回答
  •  情深已故
    2020-11-29 04:34

    I had similar problem with project using:

    1. .NET 4.7.2
    2. MVC5 solution
    3. All unit test files with file name format: Tests.cs like "HomeControllerTest.cs"
    4. Microsoft Visual Studio Enterprise 2019, Version 16.6.4

    For that project, the following Azure DevOps Pipeline settings works:

    MSBuild arguments:

    /t:Publish;Build /p:PublishDir="$(build.artifactstagingdirectory)\" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\"

    Visual Studio Test Platform Installer: Latest stable

    Select test using: Test assemblies

    Testfiles:
    *Tests.dll
    !**\obj*

    Searchfolder:$(System.DefaultWorkingDirectory)

    Test results folder: $(Agent.TempDirectory)\TestResults

    Test platform version: Installed by Tools Installer

    Other console options: /Framework:Framework45 /Diag:log.txt /Logger:console

    Build platform: $(BuildPlatform)

    Build configuration: $(BuildConfiguration)

    === YAML

    steps:

    • task: VSBuild@1 displayName: 'Build solution ***.sln' inputs: solution: '$(Parameters.solution)' msbuildArgs: '/t:Publish;Build /p:PublishDir="$(build.artifactstagingdirectory)\" /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:PackageLocation="$(build.artifactstagingdirectory)\" ' platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' clean: true maximumCpuCount: true restoreNugetPackages: true createLogFile: true

    steps:

    • task: VisualStudioTestPlatformInstaller@1 displayName: 'Visual Studio Test Platform Installer' inputs: versionSelector: latestStable

    steps:

    • task: VSTest@2 displayName: 'VsTest - testAssemblies' inputs: testAssemblyVer2: | *Tests.dll !**\obj* vsTestVersion: toolsInstaller otherConsoleOptions: '/Framework:Framework45 /Diag:log.txt /Logger:console' platform: '$(BuildPlatform)' configuration: '$(BuildConfiguration)' diagnosticsEnabled: true

    steps:

    • task: PublishTestResults@2 displayName: 'Publish Test Results **/TEST-*.xml' inputs: testResultsFormat: VSTest

提交回复
热议问题