Precompiling asp .net MVC 5 for azure deployment

lalberto8085's Avatar

lalberto8085

19 Jun, 2018 06:12 PM

I have been struggling for a while now with how to have my app precompiled to deploy on azure, I came across this post however the solution offered there doesn't work for me, once I add the file suggested on the post, my solution won't compile anymore, I get an error on the Integration tests project, maybe this is somehow relevant. Could you please point me in the right direction. If necessary I can provide extra info on the yml file

  1. Support Staff 1 Posted by Owen McDonnell on 19 Jun, 2018 07:44 PM

    Owen McDonnell's Avatar

    Can you post a configuration file and your pubxml file (please obfuscate any secrets)?

  2. Support Staff 2 Posted by Owen McDonnell on 19 Jun, 2018 08:10 PM

    Owen McDonnell's Avatar

    Build log would help as well...

  3. 3 Posted by lalberto8085 on 25 Jun, 2018 03:55 PM

    lalberto8085's Avatar

    here are the redacted versions of the yml and publish profile, thanks again

  4. 4 Posted by lalberto8085 on 25 Jun, 2018 06:48 PM

    lalberto8085's Avatar

    apparently the yml file got lost somehow, so here it goes

  5. Support Staff 5 Posted by Owen McDonnell on 25 Jun, 2018 10:33 PM

    Owen McDonnell's Avatar

    So then without the '.wpp.targets' file your build is successful? Is deployment also successful but just without precompilation?

  6. 6 Posted by lalberto8085 on 26 Jun, 2018 02:12 PM

    lalberto8085's Avatar

    Yes, it works fine, I can even see that views are compiled as part of the building process and yet are deployed non-compiled

  7. Support Staff 7 Posted by Owen McDonnell on 26 Jun, 2018 08:23 PM

    Owen McDonnell's Avatar

    Sorry, I should have mentioned before that because, in your yaml configuration file, you have publish_wap set to true, AppVeyor will create and use a new pubxml file when it builds the project. This means that your publish profile is ignored.
    Please try removing your pubxml file and add the .wpp.targets file as suggested in the post you originally linked to, and add the 'PrecompileBeforePublish' element to that file.

  8. 8 Posted by lalberto8085 on 26 Jun, 2018 08:32 PM

    lalberto8085's Avatar

    One quick question here though, can I use my publish profile and still override a few things, like usernames and passwords in the yml file?

  9. Support Staff 9 Posted by Owen McDonnell on 26 Jun, 2018 08:40 PM

    Owen McDonnell's Avatar

    No, but for this I think you can use a 'parameters.xml' file to parameterize the deployment.

  10. 10 Posted by lalberto8085 on 27 Jun, 2018 04:34 PM

    lalberto8085's Avatar

    I'm trying to use the `parameters.xml` to store the secure WebDeploy user password, can this be done?

  11. Support Staff 11 Posted by Owen McDonnell on 28 Jun, 2018 01:03 AM

    Owen McDonnell's Avatar

    Sorry, I misunderstood. The 'parameters.xml' file is not relevant in this case because it is used to replace values after deployment occurs (e.g. database connection strings).

    To use secure password you can simply use AppVeyor 'encrypt data' tool while signed in to your account and add them as environment variables as you are currently doing with gihub password.
    Then in deploy section you can use them as plain text (i.e. not with secure: key).

    deploy:
    - provider: WebDeploy
      password: $(azure_pwd)
      username: $user
    
    Here is an example project that also makes use of some conditional deployment
  12. 12 Posted by lalberto8085 on 28 Jun, 2018 07:37 PM

    lalberto8085's Avatar

    Hey, I'm sorry, I'm apparently not piecing it all together well. I just tried setting publish_wap: false and I get an error telling me there is no package to deploy. Then I set it to true and only set the values on your comment above and get an error telling me that there's no value set for Server on the Providers Settings.

    What am I getting wrong here?

  13. Support Staff 13 Posted by Owen McDonnell on 28 Jun, 2018 08:09 PM

    Owen McDonnell's Avatar

    I didn't mean for my code sample above to be a complete set. Server is a mandatory setting, but I assumed you would just use the same from the redacted yaml you provided.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac