-
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
Target framework attribute file should be written to IntermediateOutputPath #1479
Comments
That's exactly what we did in Roslyn and it seems to be working great |
Related issue dotnet/roslyn#10116 |
@AndyGerlicher Is there anything technical or organizational holding this up for such a distant release, or would I be able to file a pull request for this change? It looks to me like a simple change to |
Another complication: When written into https://stackoverflow.com/questions/45950644/prevent-net-core-2-0-from-leaving-files-in-tmp-on-rhel7 |
On a shared institutional Linux system like ours, one problem is as @dasMulli described, with compilation failing. Another problem is lifecycle control: Our sysadmin does not want files in the global Being "solved", from the sysadmin's perspective, entails a solution which applies to all current & future users at all times; which does not depend on user discipline; and which does not make impositions on any of the system's non-.NET users. So it cannot depend on the user remembering to override the built-in default in their project files, for instance. It sounds like @jeffkl's proposal could solve both problems for us. Whether it does solve them depends on the default behavior of Another desirable property: the user not having to depend on developer discipline, either. A richer, but more complex solution might have a hierarchy of settings: a systemwide setting in |
I think there are two options here:
Personally, I favour option 1 with a project-unique filename like |
1 sounds good to me. 2 would still throw an unnecessary warning when building projects in parallel, due to conflicts on the same shared file. I don't think the unique file name is needed, since the obj path is already unique. |
Getting rid of the warning is a good, forgot about that. Some projects are configured to use a shared intermediate output path or even a shared base intermediate output path so if the file name is unique to the projects, there won't be conflicts. If it is not unique, then we're in the warning-instead-of-error and race condition handling business again 😢. Any change should not break these projects.. |
I don't think any change proposed here would break them any more than they are broken today. |
@dasMulli said:
One other option - for Linux at least - is to use
If this data is not meant to be kept around, this is probably the best location on modern Linux systems. |
I saw this last week on one of our build servers where we do concurrent builds. |
/cc @nguerrera |
Adds workaround for dotnet/msbuild#1479
@tmat It's different code that happens for all projects vs. generated assembly info being SDK project feature. |
Can the SDK suppress it and write it to the AssemblyInfo.cs? |
I am agree to @tmat
For TargetFramework attribute implementation can be the same:
keeping autogenerated .cs file with TargetFramework attribute in Temp folder making some troubles:
@AndyGerlicher can you take a look at my comment? |
I'm hitting what @maximpashuk noted:
Is there a known workaround in the meantime? |
In root solution directory I created a file Directory.Build.props with following content <Project>
<!-- incremental builds in TeamCity -->
<PropertyGroup>
<TargetFrameworkMonikerAssemblyAttributesPath>obj\TargetFrameworkAttribute.cs</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>
</Project> Probably this is not a best solution, but it works, incremental builds now works in TeamCity as expected. |
I vote for @tmat and @maximpashuk solution, intermediate dir all the things and into the Sdk, we go! 😁 |
@maximpashuk Makes sense. Thanks. That should get me past it for now. |
@livarcocc would it be possible to prioritize this? This is an impactful issue that's very easy to fix and has been open for three years now. Seems like low-hanging fruit. |
With the fix for this being merged into |
@bording I updated the milestone to 16.6 as I believe master is 16.6. |
works now for me in 16.6.2. I see |
Currently GenerateTargetFrameworkMonikerAttribute defaults to write the target framework attribute file to
%TEMP%
. This means if multiple projects are building at once and the file doesn't exist, they can hit a race condition. The currently solution is to have the<WriteLinesToFile />
task marked toContinueOnError
which emits a warning.I propose that we instead default to have the target framework attribute file be written to the
IntermediateOutputPath
which in most cases would be unique per project. The overhead on small projects would be very minimal and in large projects they would no longer have the race condition. I would change this line to say:FYI @jaredpar
The text was updated successfully, but these errors were encountered: