Fix PublishSingleFile not working with ClassLibrary references#10
Fix PublishSingleFile not working with ClassLibrary references#10
Conversation
Co-authored-by: haonanttt <186026394+haonanttt@users.noreply.github.com>
|
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0 |
haonanttt
left a comment
There was a problem hiding this comment.
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0
|
@haonanttt Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
haonanttt
left a comment
There was a problem hiding this comment.
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0
|
@haonanttt Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
|
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0 |
|
@haonanttt Unfortunately I hit an unexpected error while processing your comment. I've automatically reported this to GitHub. You can ask me to try again later by mentioning me in a new comment. If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: Sorry for the inconvenience! |
haonanttt
left a comment
There was a problem hiding this comment.
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0
haonanttt
left a comment
There was a problem hiding this comment.
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0
haonanttt
left a comment
There was a problem hiding this comment.
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0
|
Note, the key problem for this issue is not in condition PublishSingleFile. But actually any publish process if we project referenced a winui class library. And a temporarily workaround is to somehow copy all the contents inside ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0\runtime-identifier into ...\ClassLibrary1\bin\Debug\net8.0-windows10.0.19041.0 @copilot |
…File Co-authored-by: haonanttt <186026394+haonanttt@users.noreply.github.com>
I've updated the fix to address your feedback. The solution now applies to all publish operations, not just when PublishSingleFile is enabled. I've removed the condition that limited the fix to PublishSingleFile scenarios, renamed the targets file and target name to better reflect its broader scope, and updated the documentation accordingly. The changes in commit 4498b6e should now handle any publish process with WinUI class library references. |
Thank you for the clarification. I've already addressed this feedback in commit 4498b6e, where I updated the fix to work with any publish process (not just PublishSingleFile). The solution now applies whenever a WinUI class library is referenced, regardless of PublishSingleFile setting. The targets file has been renamed to reflect this broader scope, and the implementation no longer checks for the PublishSingleFile condition. |
Issue
When a project using Windows App SDK references a class library and has
PublishSingleFile=trueenabled, the build process incorrectly looks for the class library assembly in a path that includes the runtime identifier (e.g.,win-x64). This causes build failures with errors like:Solution
This PR adds a new targets file
Microsoft.WindowsAppSDK.PublishSingleFile.targetsthat properly resolves class library references during the publish process whenPublishSingleFile=trueis enabled.The targets file:
_ComputeResolvedFilesToPublishListwhenPublishSingleFile=trueResolvedFileToPublishitems with the corrected pathsChanges
Microsoft.WindowsAppSDK.PublishSingleFile.targetsfileMicrosoft.WindowsAppSDK.Foundation.targetsto include the new targets fileTesting
Created a test solution with a class library referenced by a main project using
PublishSingleFile=trueto verify the approach.Fixes #9.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
crl3.digicert.comdotnet build -c Release(dns block)crl4.digicert.comdotnet build -c Release(dns block)ocsp.digicert.comdotnet build -c Release(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.