Base solution for your next web application
Open Closed

Publish ASP.NET Core to Azure #3841


User avatar
0
bilalhaidar created

Hi, I have setup a continuous integration in VSTS and all is working fine and the web app is published successfully. However, I noticed that in the files that were published into Azure, there is only 1 appsettings.json file. This is the one for the Public website rather than for the backend one (Web.Host).

What shall I do? How could I publish the Web.host and Web.public to two different web apps so that each web app gets its own copy of the appsettings.json?

Thanks


9 Answer(s)
  • User Avatar
    0
    bilalhaidar created

    For anyone in the same situation as mine. I found a way out.

    In the VSTS Build Definition, select .csproj instead of .sln. This way, only the project you want to build, will be built, others won't!

    This works like a charm. If you need help while doing this step, ping me here. I will be glad to help.

    Thanks Bilal

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @bilalhaidar.

  • User Avatar
    0
    bbakermmc created

    Did you ever run into an issue where the build fails? Can you screen shot your build steps?

    I get this random error that makes no sense. Could not copy the file "\.\nul" because it was not found

  • User Avatar
    0
    ignasi created

    Hi all, What kind of build definition template are you using? I'm using Visual studio online(VSO) and i tried with 2 provided templates (ASPNetCore & ASPNetCore(.Net Framework)) and all builds were failed when i tried to build only Host project. Can you help me please? maybe with some images ? I think that my error is in the paths, when i get source from Host instead of All.sln and build path is .csproj instead of wildcard(**/.csproj), and I tried many unsuccessful options.

    Thanks, ;)

  • User Avatar
    0
    alper created
    Support Team

    write the command that you are running? and the exception

  • User Avatar
    0
    ignasi created

    Hi alper, I run a build definition template for asp.net core, you can see the exception on the images attached. [attachment=1:2njvdku6]2018-06-01_09h13_32.png[/attachment:2njvdku6] [attachment=0:2njvdku6]2018-06-01_09h16_26.png[/attachment:2njvdku6]

    As you can see I build successfully ( when I build a *.sln , all projects) but I can`t when I try to build only the Host project. This is my problem

    Thanks,

  • User Avatar
    0
    ismcagdas created
    Support Team

    @Ignasi is the Nuget Restore step works on the sln file or on the Host.csproj file ?

  • User Avatar
    0
    ignasi created

    [attachment=0:3nhqmqol]2018-06-01_10h10_23.png[/attachment:3nhqmqol]

  • User Avatar
    0
    ignasi created

    Solved! GetSources from */All.sln Nuget Restore path from *.sln Build path from **/myprojectName.Web.Host.csproj

    Thanks!