1
votes

I need to create an azure artifact for a web app written in .net framework. The artifact will be used to automate the deploy.

If i use the generic artifact publisher, i will include code files in the artifact and other undesirable items.

There is some equivalent way to build a clean artifact for classic web apps build on .net framework?

1
A built .net framework app does not contain code files.Sudip Shrestha
The build only creates the binary files, that go to bin folder. The site is made of other files, like aspx, cshtml, js files, for example. And all are in the same structure. Only by publishing the project a clean package or install is created.MiguelSlv
Those files are needed for the application to work. CSHtml cannot be simply downloaded from the browser (just like a DLL cannot be downloaded). JS, CSS, and HTML are downloaded as is. So, you shouldn't put anything you don't want your normal user to be able to see.Sudip Shrestha
Let me put the problem this way: to create an artifact i need to provide a path. What path could i provide that would include all the app structure, binary files and other files in every sub folder, but no code files or other project files?MiguelSlv

1 Answers

1
votes

Found a solution by automatically run publish on build. The steps are:

  1. Create a publish to folder profile, name FolderProfile.

    I used the defaults that point to a target path at bin\app.publish

  2. Use MS Build to the publish to folder by using FolderProfile saved profile. Add the following task to yaml file, right after the build solution task:

    - task: MSBuild@1
      inputs:
        solution: 'MyPortal\MyPortal.csproj'
        msbuildArchitecture: 'x64'
        msbuildArguments: '/p:DeployOnBuild=true /p:PublishProfile=FolderProfile'
    
  3. Publish the artifact to azure pipeline by adding this another task to the yaml file:

     - task: PublishPipelineArtifact@1
      inputs:
        targetPath: '$(Build.Repository.LocalPath)\MyPortal\bin\app.publish'
        artifact: 'My portal'
        publishLocation: 'pipeline'