-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NET.Sdk build runs unexpectedly #5486
Comments
Because you have specified the new target as an Consider hooking a more-specific target that won't be called as often, or if that's not possible, modify your target for design-time builds. |
@rainersigwald thanks for the feedback and the design-time build links... certainly an interesting read. It does have information key to resolving this. Still, I think the documentation and/or defaults are a bit misleading and perhaps undesired: Even removing the I was hopeful that the I'm trying to run tasks before the
(although perhaps For example: this project file will create an
so ok, the default is
Delete the Still, given all of this, the workaround to determine whether a target is running in a design-time build does work, and this project does not run relentlessly:
The For reference, the reason I need to run the FPGA synthesis build before the
and these of course break the normal msbuild, so I switch to
Also, note that I do not have a
|
The default is empty. When loading a project in Visual Studio, the project system does a design-time build, with the property set to
Your example here doesn't do that. It changes the default value in that project to
Did you follow step 1 there?
|
Hi @gojimmypi, is this still an issue that you are facing? |
Hi @maridematte yes, there seems to still be undesired behavior. In VS2022 17.11.5, the tiny project file now gives an error at load time: It is arguable whether a project file should refuse to load if there's no configuration. That's probably off topic. I updated the project like this with a configuration to appease the above error message:
It appears the build still attempt to run at load time. I also now see this error message repeated 20 times at project load time:
I'd like to be able to load a project, ideally a custom build project, without the build running immediately at load time. I must have missed the "Project System Tools" suggestion extension; is that still advised / required? Thank you. |
The design time build when VS opens / loads a project is a feature that we do not plan on disabling anytime soon from my understanding. For the " Project System Tools" suggestion, if you're using a new version of VS there are some new steps that you can follow and get the output results of the design time build and check if the variable. |
Hi @maridematte and thank you for the information. Coincidentally, I'm working on a project that also has some interesting "design time build" issues. In this case, I'm using cmake-generated Visual Studio projects to add support for wolfSSL encryption to realm-core using Visual Studio 2022. I added this code snippet into the
The curious thing here is that the entire project file seems to be regenerated when the underlying cmake files are detected as having changed. The problem of course, is that when the file is regenerated, the hand-crafted design-time code is lost. Although still in the general topic of builds running unexpectedly, I realize this is also quite a bit different than my original example. Still, I was wondering if you'd happen to know how to add a project For reference, there's some CMake projects in Visual Studio information, but the design-time (or project load, or project refresh-time) is not mentioned. I'd like to be able to detect the initial reload of the project and take certain additional steps. I'll still be revisiting the non-cmake builds soon. Thanks again, cheers. |
I honestly have no knowledge of the CMake generators for MSBuild. But you can contact the CMake folks with the question on their repo. |
Hi @maridematte I have another question on this "build runs unexpectedly" topic: I've been working on a Visual Studio project for Realm, specifically this project directory and one of the super annoying problems is when something (?) triggers all of the project files to convert my hand crafted, variable-based directory values into explicit, hard-coded, fixed values. For instance: I'm adding the variable values as I want to share the project files on GitHub, but I don't want my specific version path of Visual Studio (which varies by community, Professional and Enterprise editions), but also the GitHub cloned directories that contain my username, in the path. At first, I was willing to live with just an annoying feature: once cloned and loaded, the end user would have values converted to their specific environment. Not very friendly for contributions, but ok. However, recently I started adding some custom property files to be included: (e.g. realm-core-GlobalProperties.props). Yesterday it was working great. This morning I am greeted with the dreaded "all your project files have been changed, do you wish to reload them?". This is the message that occurs when variable paths are replaced with actual paths. This is first I've seen this happen spontaneously while the computer was unattended. The really undesired thing is that my hand-crafted include files were also stripped out: I can work on the project files all day long, hand crafting, performing test builds, reloading, and more. I have no idea what event occurs to spontaneously restructure all of the project files (there are over 150 of them!), wiping out all changes. Do you have any idea what might be causing this, and how to prevent it? Thanks so much. |
@gojimmypi Can you please open a feedback ticket instead? It looks like the C++ project system is doing something unexpected there, so we'll need that team to look at it. |
Hi @rainersigwald thank you for the suggestion. I submitted this related feedback ticket: |
*edit: Issue title changed to "NET.Sdk build runs unexpectedly". In short, a project file as tiny as this:
Seems to run automatically not only at Visual Studio startup time, but also gets triggered when the
init.log
file is manually deleted in File Explorer.There's no build output, and no other indication that it runs. (other than the
init.log
that keeps re-appearing)Edit 2:
The tinyproject mentioned above is not at all happy in VS2017, maxing out CPU with msbuild running continuously:
Original issue text:
This is a simplified custom msbuild project file from a larger one that targets building an FPGA in a WSL process. I'm using the newer SDK project files after being unable to see the long-running process from WSL in realtime, as mentioned by @rainersigwald in #5451 (comment). Note the somewhat wonky thing I am doing to switch the platform back to
anycpu
just before the mainCoreCompile
target. That's because I want to be able to do this for the build configuration management:Ideally I'd like to omit the
CoreCompile
target altogether (it really does not like the custom platforms, of course)... but perhaps at some point the main C# app will contain some sort of diagnostic app.The problem I am seeing is that files created by the build do not stay deleted after the clean process, nor even a manual
del
from the DOS prompt.Steps to reproduce
Open the deletePersist project file in the deletePersist directory of this repo :
Then build and clean in Visual Studio 2019:
another.bit
andtop.json
files re-appear after having been removed."dir top.json" exited with code 1.
showing the file was gone.Project file:
Directory contents:
Expected behavior
Deleted files stay deleted.
Actual behavior
Deleted files created during build reappear. Manually created files such as
other.json
created withcopy con: other.json
at the DOS prompt will however, be deleted and stay deleted with theClean
process.Note how the build output shows the file missing just before completion as shown by the warning for
dir top.json
:Yet, a few moments later the
top.json
andanother.bit
files will reappear.Environment data
msbuild /version
output:OS info:
Microsoft Windows [Version 10.0.18363.900]
If applicable, version of the tool that invokes MSBuild (Visual Studio, dotnet CLI, etc):
Plus this abbreviated list that may be of interest:
The text was updated successfully, but these errors were encountered: