-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Certain MSBuild configuration causes _wpftmp build output directories to not be deleted after each build #2930
Comments
Just confirming this is still an issue with 3.1.301. Only impacts WindowsDesktop sdk projects. In our case we have a custom |
This is not a bug; By Design AFAICT. Deleting build artifacts generated by the temp projects had never been a goal. The only goal has been deleting the Depending on various build configuration choices, the output directories can be named after either (a) the target assembly or (b) the project name (or something else, which is uncommon). When (a) is in effect, the When (b) is in effect, msbuild will provision This works the same in .NET Framework and .NET Core; in SDK style projects and in older style projects. |
That's interesting, thanks. In our case however this does only seems to be impact WindowsDesktop sdk projects. I've modified the solution provided by @nathan-alden-hp to include a wpf .net framework project and .net core console app: repro.zip These all pick up their output path from the Directory.build.props, but it's only the sdk style WindowsDesktop project that leaves behind the temporary directories: From what I understand I'm probably falling into scenario b as both the output path and intermediate path are modified based on the $(MSBuildProjectName)
NB: I only see these extra directories left over in the bin directory, the obj directory is behaving as expected. This does feel like a bug (or at least undesirable behaviour) and only started happening once we migrated our WPF apps to SDK style projects. That said, I can work around it easily enough, by adding a post build step in Directory.build.targets to delete the directories:
|
I'm not sure why it should even be "by design" for a build system to repeatedly generate new directories that appear to never be cleaned or wiped... |
Honestly, I also don't agree that temporary files and directories will not be deleted after the build has finished. |
This behavior has been driving me nuts as well. This shouldn't be by-design. No other project type does this. |
Any news on this? |
I confirm that this bug also affects non-SDK .NET Framework projects, as suggested by the last paragraph of vatsan-madhavan's comment from Jul 3, 2020. I disagree with the assessment that it is not a bug. Even if the implementation is operating as designed, that merely shifts the root cause of the bug from the implementation to the design. This arguably makes it more a severe bug since it could have been caught earlier in the production pipeline and was not. |
I created this post-build target to deal with these folders: <!--
Delete temporary compiler output caused by this bug:
https://github.com/dotnet/wpf/issues/2930
-->
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="FOR /D %%G in ("$(BaseOutputBinPath)*_*_wpftmp") DO RMDIR /S /Q "%%~G"" />
</Target> |
Any news on this? |
I'm running into this issue as well. For those that want to investigate the issue themselves I believe this is where the problem originates and where the files but not directories are deleted: GenerateTemporaryTargetAssembly The way I've worked around is by adding an extra
Then there is a task to delete my entire tmpwpf folder so no artifacts are left behind. Perhaps this is also a good solution for the WPF team? Just store the wpftmp projects somewhere else and delete that entire folder, instead of enumerating the files and deleting each one. It could be just a special subdirectory in the BaseIntermediateOutputPath or perhaps even a random directory in %temp%. There are some other places in MSBuild that use the generated project name, so even if it is inside a new random directory the project name should perhaps remain like it is. |
|
And there is also an |
@ThomasGoulet73 Those are good points you're making, I'll wait to see how your fix progresses. |
Any news on this? |
@msedi It looks like VS2022 will try its best to clean out these folders... |
@lindexi: Thx. Do you know which version. I'm having the latest official version. Are you using the previews? |
Even with the latest Visual Studio preview the problem still exists (more than 2 years after....) 👎 |
@lindexi: We are using VS 2022 17.2.5 and just noticed that our project folders are also polluted by random _wpftmp project files. Unfortunately all these files are also published to Github. |
What is the status? |
I successfully worked around this issue by replacing: Obviously this will not work for you if you need |
@chipplyman: You are right, I need the |
Any news? |
@yamithrain Could you test VisualStudio 2022 17.6.5 ? |
The issue is still present with 17.6.6. |
Sad... |
I also still have this problem in the latest preview: 17.8.0 Preview 1.0 |
I also ran into this issue. I found the problem to be caused by: <BaseOutputPath>..\..\bin\$(MSBuildProjectName)</BaseOutputPath> In order to fix those <BaseOutputPath>..\..\bin\$(AssemblyName)</BaseOutputPath> I'm unaware of any side-effects with this configuration. Everything seems to work fine. More (possibly relevant) information about my setup:
Edit: Only after posting this did I notice someone above already mentioned this workaround:
|
* Start implementing plugins for better separation * massive refactor in attempt to split appdomains for plugins * (breaks old mapping profiles) * Fix error when switching from mouse button trigger to keyboard trigger and clicking in the combobox where the mouse button capture textbox is. * Simplify code by removing legacy * SImplify grouping actions * Fix profile and add helpful opposite mapping generator tool * Change solution hierarchy * Restrict AppDomain plugins went from Zone.MyComputer -> .Internet * create keypair in ci * Install the .NET framework tools * Run command in workflow * Plugin permissions. Plugins disabled by default * update readme (icon is no longer used) * Plugin action runs in seperated process * Remove unused dependencies. * Fix action name display for mapping * Fix Lua plugin script calls (NOTE: laggy when using MessageBox) * convert project to sdk style * Add editorconfig and start cleaning up * Fix documentation. Update namespaces to match files (breaks profiles) * Include all projects in tests, disable building docs on debug * Add messagebox script action * Add tests for pluginhost * Remove administrator from window title test * add some icons to ui * Add enabling/disabling plugins * Close plugins when Key2Joy shuts down * Fix appcommand failing * Fix plugin permission form crashing. Fix plugin load exception not showing warning * Handle plugin host closing better when app has crashed * Seperate host and client logic in remote event subscriber * Ensure the PluginHost shuts down if the app crashes * Better error output for plugins * Fix cmd interop not working, add some tests * also generate docs on plugins * Fix build order with docs * Fix enum script parameters and ensure actions share environment scopes * Fix _wpftmp folders being created dotnet/wpf#2930 * Fix sequence action. Add disabled trigger/action for unloaded plugins on startup * Discover exposed Enums in plugins * add doc link text + fix newline trimming + add tests * add tests for whats easy to test (and generate tests for) * have docs show returns; fix passing array to exposed method; incl tests * remove assemblyinfo files (move to csproj) * Add powershell build script * add pre-release workflow
… to not be deleted after each build. See: dotnet/wpf#2930
… to not be deleted after each build. See: dotnet/wpf#2930
I am here due to the same problem (.Net 7.0, VS2022 17.8.5). I have thousands of those *wpftmp folders in my build folder... |
@AFract What is your code in Directory.Build.Props ? |
Hello, thank you for answering.
|
@AFract Sorry, I can not repeat the problem with your Directory.Build.Props. And I think that there are other preconditions I don't know about. Could you provisionally remove the |
To resolve this bug, you have the choice between: Redefine the property <AssemblyName>Your_Assembly_Name</AssemblyName> Alternatively, in a more global way, Redefine the <PropertyGroup Condition="$(ProjectFriendlyName.EndsWith('_wpftmp', StringComparison.CurrentCultureIgnoreCase))">
<ProjectFriendlyName>$([System.IO.Path]::GetFileNameWithoutExtension($(ProjectFriendlyName)))</ProjectFriendlyName>
</PropertyGroup> |
.NET Core 3.1.201
Windows 10 build 18363
Problem description:
Certain MSBuild configuration causes the compiler to leave behind directories with a
_wpftmp
suffix after a build completes. The problem seems to be related to custom<BaseOutputPath>
s.Actual behavior:
Temporary output directories are left behind after every build. A new directory is created per build.
Expected behavior:
Temporary output directories are deleted after every build.
Minimal repro:
WpfApp1.zip
The text was updated successfully, but these errors were encountered: