简体   繁体   中英

Is there a way to manually trigger Visual Studio to update .csproj files?

I sometimes lose my pending changes to the.csproj file. I'm left with a changeset of new files, which still carry the appended [add] tag in the Team Explorer, but pending updates to the.csproj file are wiped out.

I can manually edit the.csproj to add them, but this is tedious and error-prone. Is there a way to re-run whatever process normally updates the.csproj file automatically?

Normally, changes to.csproj files should be very rare, when using the new SDK style projects.

Since by default, all.cs files are included, you do not normally need any update to the project file if files are added or removed. So I suggest you remove all <Compile Add/Include/Update /> lines that refer to code as well as the line that says <EnableDefaultCompileItems>false</EnableDefaultCompileItems> if you have that.

For most projects that works just fine. It will reduce the frequency of changes to the project file significantly (and make it a lot easier to read).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM