jeremytammik / RevitLookup

Interactive Revit RFA and RVT project database exploration tool to view and navigate BIM element parameters, properties and relationships.
http://thebuildingcoder.typepad.com
MIT License
1.03k stars 294 forks source link

`main.yml` file in the release folder? #243

Closed ricaun closed 1 month ago

ricaun commented 1 month ago

I was looking the last release project and noticed that in the publish folder there is a main.yml file.

Looks like the Serilog.Sinks.Autodesk.Revit is adding the main.yml file in the content for some reason.

The odd part is that is only added in the publish folder, the Debug R25 does not have the file, maybe the copy is coping extra content.

This is coping all the content that is not Never, if the file is set as Content the file is copy to the publish. Don't know if is intended feature.

<FilteredContent Include="@(Content)" PublishDirectory="%(Content.PublishDirectory)" Condition="'%(Content.CopyToPublishDirectory)' != 'Never'"/>

https://github.com/Nice3point/Revit.Build.Tasks/blob/d778daf98e933441b7931a4ab2460aa91a066f5a/source/Nice3point.Revit.Build.Tasks/targets/Nice3point.Revit.Publish.targets#L22

If I set any file as Content is copy to the publish folder, even with the Copy to Output Directory to Do not copy.

Nice3point commented 1 month ago

I guess the problem is related to this line: https://github.com/dosymep/Serilog.Sinks.Autodesk.Revit/blob/master/src/Serilog.Sinks.Autodesk.Revit/Serilog.Sinks.Autodesk.Revit.csproj#L75

and it's included in the Nuget package изображение

this was not present in the previous version 1.0.0, most likely a bug in the Nuget package @dosymep

If I set any file as Content is copy to the publish folder, even with the Copy to Output Directory to Do not copy.

i'll check

Nice3point commented 1 month ago

This is coping all the content that is not Never, if the file is set as Content the file is copy to the publish. Don't know if is intended feature.

Yeah, this is expected behaviour https://github.com/Nice3point/Revit.Build.Tasks#publishing

@ricaun do you have "Do not copy" option? Because i'm not изображение

ricaun commented 1 month ago

Yes, but I'm not explicit setting the CopyToPublishDirectory to never.

image image image

You probably need to check if Content.CopyToPublishDirectory is not empty or only copy is is Always or PreserveNewest.

Nice3point commented 1 month ago

Yes, but I'm not explicit setting the CopyToPublishDirectory to never.

But you show CopyToOutputDirectory) This is not the same as CopyToPublishDirectory this file is not included in the bin directory

ricaun commented 1 month ago

But you show CopyToOutputDirectory) This is not the same as CopyToPublishDirectory this file is not included in the bin directory

Ops, didn't see that is two different properties.

So, by default gonna copy every content to the publish folder, even files that is not coping to the output folder.

dosymep commented 1 month ago

yep, I will remove main.yml :)

ricaun commented 1 month ago

yep, I will remove main.yml :)

Yep!

@Nice3point Still find odd that by default all the content is copy to the publish folder, I thought the CopyToOutputDirectory was the main propriety used to copy to the publish as well.

Nice3point commented 1 month ago

yep, I will remove main.yml :)

you can write something like this: <None Update="$(SolutionDir)/.github/workflows/*.yml" Link="ci/%(Identity)" />

Or just use SolutionItems to add this file to the Solution explorer

Nice3point commented 1 month ago

@Nice3point Still find odd that by default all the content is copy to the publish folder, I thought the CopyToOutputDirectory was the main propriety used to copy to the publish as well.

Content implies the use of the file for publishing, its other purpose is wrong. And you should use None or something else, but not Content https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items?view=vs-2019#content

CopyToOutputDirectory is not used because the files will be copied to the root. PublishDirectory together with CopyToPublishDirectory allows you to configure the destination directory

ricaun commented 1 month ago

Content implies the use of the file for publishing, its other purpose is wrong. And you should use None or something else, but not Content https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items?view=vs-2019#content

CopyToOutputDirectory is not used because the files will be copied to the root. PublishDirectory together with CopyToPublishDirectory allows you to configure the destination directory

Yes makes sense, content could be used to publish. The problem I see is that the default CopyToPublishDirectory is copy the file and the main.yml file was injected in the publish without noticed. Is better to explicit set what you want to send to the publish that's how the CopyToOutputDirectory works. I would definaly change to not copy.

Nice3point commented 1 month ago

I would definaly change to not copy.

Agree, I will update the publication to include PreserveNewest and Always

ricaun commented 1 month ago

I would definaly change to not copy.

Agree, I will update the publication to include PreserveNewest and Always

You could use the PublishDirectory as well to assume that the file need to be copy to the publish folder.

Nice3point commented 1 month ago

You could use the PublishDirectory as well to assume that the file need to be copy to the publish folder.

It's more logical to split it up, and keep the 2 properties to be responsible for their own purpose

Nice3point commented 1 month ago

@ricaun new version of Revit.Build.Tasks is available

In general, Microsoft's approach will now be used https://github.com/dotnet/sdk/blob/f6a8556dab12a7c27d6d0e66e93194a42dcde25a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets#L422-L444

Always and PreserveNewest are handled separately as well https://github.com/Nice3point/Revit.Build.Tasks/blob/main/source/Nice3point.Revit.Build.Tasks/targets/Nice3point.Revit.Publish.targets#L22-L23

RevitLookup I have updated, waiting for a fix in Serilog.Sinks.Autodesk.Revit

dosymep commented 1 month ago

done Serilog.Sinks.Autodesk.Revit v2.0.1