Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / Remove metadata in dev...
Finance forum

Remove metadata in dev environement

Posted on by 175
After creating a data entity in my project and syncing the database +  building project, I decided to remove the data entity again to create it in another way. 
When trying to create the data entity again i get an error message saying that it already exists and I can see that the meta data still exists. 

I have tried to sync the database again, refreshing models and getting the lates version from my remote repo, but it is not removed from the metadata folder. 

What is the normal procedure in cases like this where meta data is created due to changes in a project, but you then want to remove the changes again? Do i realy have to remove the metadata manually?  
 
  • CU30040608-0 Profile Picture
    CU30040608-0 175 on at
    Remove metadata in dev environement
    Well :) You saved my day. Thank  you. 
     
  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 228,135 Most Valuable Professional on at
    Remove metadata in dev environement
    I remember this problem from the time when 'AX 7' was brand new (2016) and I was hired by Microsoft as a trainer of workshops called AX Accelerate for Developers. One of the labs there involved creation of a data entity and people sometimes got a synchronization error because of a label conflict (as I found after investigating the issue).
     
    I thought that the problem had been resolved, because I work on a project where developers sometimes duplicate data entities and forget to change the label, but synchronization still works. The result is that the AOT name of the data entity is used instead of the label. But I've heard recently that someone ran into the same problem again, therefore it seems to still happen in some cases. And that's why I asked you to verify it.
  • CU30040608-0 Profile Picture
    CU30040608-0 175 on at
    Remove metadata in dev environement
     
    Sure :)  
     
    1. I am able to build model twice. 
    2. Renaming the label seems to have fixed it! :)

    How could you see from my code samles that there was a problem with the label? And how can a label cause a database synchrornization error?  

     
  • Martin Dráb Profile Picture
    Martin Dráb 228,135 Most Valuable Professional on at
    Remove metadata in dev environement
    I'm an bit confused by your description. Let's simplify it by ignoring the Visual Studio project and let's focus just on the model only. Are you able to build the model twice or not?
    By the way, doesn't your entity has the same label and existing entity?
  • CU30040608-0 Profile Picture
    CU30040608-0 175 on at
    Remove metadata in dev environement
    Hi Martin
     
    I think we are getting close :)  

    I deleted the record from DMFEntity through the GUI like you suggested. After deleting the record i was able to rebuild the solution, build model and sync with database and spin up the GUI locally. I can build as many time as i want without any errors, but as soon as i try to rebuild it fails. It looks like the same erros as before: 


  • Martin Dráb Profile Picture
    Martin Dráb 228,135 Most Valuable Professional on at
    Remove metadata in dev environement
    Yes, I would delete the record from DMFEntity. I would assume it should happen automatically, but maybe this assumption is incorrect.
     
    You can do it through GUI (Data management workspace > Data entities). If a validation prevents the deletion (e.g. because the entity is currently used in a project), maybe this is the reason why it wasn't deleted automatically. But this is merely a theory.
  • CU30040608-0 Profile Picture
    CU30040608-0 175 on at
    Remove metadata in dev environement
    Hi Again Martin, 

    It looks like you are correct regarding the DMFEntity table. f

    I have now done the following: 
    1. Gotten the latest version of my project and meta data from remote repo. 
    2. Removed a xxxStagingWorker table from the database. 
    3. Build my custom model with all of its dependencies 
    4. Syncronized the database. 
    5. Created a data entity using HcmWorker as master and using the same name for the entity as last time.  
    6. Build and sync the project. 

    When building I get the following errors (same as last time)


    I can see that one of the errors is about the record already being in the DMFEntity table like you talked about. Should i delete it directly in the database or how would you go about it?
  • Martin Dráb Profile Picture
    Martin Dráb 228,135 Most Valuable Professional on at
    Remove metadata in dev environement
    Well, I can't comment on the file if you don't know what it was.
     
    Your other remarks suggests that you may actually have a problem with DB synchronization. That may be unrelated to the deletion from the application. For example, you entity could have been successfully deleted both from metadata and from binaries, but you still have something in database that prevents you from adding an entity of the same name.
     
    If nothing else, make sure you run DB sync after deleting an entity and rebuilding the model, before trying to create it again. You may also want to check that the entity doesn't exist in DMFEntity table. My guess is that that's where you're getting the error (but I can only guess if you don't give any concrete information).
  • CU30040608-0 Profile Picture
    CU30040608-0 175 on at
    Remove metadata in dev environement
    Hi Martin. 
    I just made a search in the K:\AosService\PackagesLocalDirectory for the name of my data entity. I dont remember what kind of files i deleted and they are still giving me problems as i keep getting build errors when i add a data entity with the same name. Telling me something already exists in the database. And correct. I can see that the staging table is still in the database. 
    I am not sure why i was not able to just delete the data entity from my project, updating the model and then syncing with the database, in the first place. 
    I guess best scenario now is to complettly remove the metadata folder and getting the latest version for devops. But i am also unable to delete most folders in K:\AosService\PackagesLocalDirectory even though i have stopped the AOS service. 
    Any suggestion on how i can dig myself out of this hole? 
  • Martin Dráb Profile Picture
    Martin Dráb 228,135 Most Valuable Professional on at
    Remove metadata in dev environement
    Can you please explain what "files in metadata" are you talking about? If you see the .xml file, your entity wasn't actually deleted (and recompilation won't do anything, because code is still the same). And you can't say whether the entity exists in binaries just by looking at files - you'd have to decompile the right .netmodule file.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 9th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,277 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,135 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans