-
Notifications
You must be signed in to change notification settings - Fork 890
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
Use a build properties file instead of custom build actions to copy files #821
Conversation
It would be possible to generate the file during the build, but the file is small and you already make commits to update the native binaries in source control so it wouldn't save much. Including the file makes it easier for a user browsing this repository to understand how the integration is implemented. |
In the original commit, the Publish command would produce two copies of the native binaries in the published website. I believe this is similar to the issues described in #597, #700, and #705 (and maybe others). By changing the item type of the MSBuild items from |
Sorry. I'm far from being a MSBuild pipeline expert, so you may have lost me here a bit 😉 With this latest change, the whole |
Yes, the NativeBinaries folder that appears as bin\Debug\NativeBinaries... for a normal C# project build appears in bin\NativeBinaries... when publishing an MVC project. Unlike commit 2e9bee6, the output only appears under **bin**. |
@sharwell Thanks for the explanation. Looks very cool! I really like this. Looks like a simple way to solve the publishing issue. @sitereactor How do you feel about this? |
@sharwell I've tested it.... and I like this very much! ✨ Could you please squash those two commits together and rebase this PR? |
973e303
to
bf93cba
Compare
Done 👍 |
One nitpick remaining on my side. Can you make it do this only for Windows? |
@Therzok I'm sure that is possible, but I would lean towards making that a separate request to address. My understanding is this change (as currently implemented) improves the reliability of the build process, package upgrade process, and addresses clear problems with the deployment configuration. The inclusion of Windows binaries in deployment to other systems is sub-optimal, but not problematic because the files would simply go unused. |
I agree with that, I meant that we should log an issue about this. |
Anyone having success publishing with TFS Build Server? I can get this to work with the publish from Visual Studio, the Build server can't do it for some reason ... |
Could you please elaborate regarding this. How is it configured, what error do you encounter, traces...? /cc @ethomson |
I'm not an expert with TFS Build, so I'll try to explain to the best of my knowledge. The way it is configured right now, I think the problem has to do with the way MSDeploy handle the publish. So, the build is done on a machine (A) and once the build is done (which contains the NativeBinaries folder in the bin folder), it starts to deploy using a web service on another machine (B). What the web service does is that it updates files individually, according to the publish information, but I may not be correct on this. However, what it does right now is it deletes the NativeBinaries files and start updating other file. Since the files aren't in the publish info, the NativeBinaries folder never gets to the other machine (B).
|
Also, another way I've been able to make it work (but I'd rather not use this as it's not easy to update), is to include the NativeBinaries folder into the project and create a BeforePublish target in the csproj file:
Now, this will work once. The IIS ApplicationPool is keeping a handle on the native binary files and I can't overwrite or delete them on another build. So, I need to kill the pool before doing a build which is not really helpful. Also, I wrote the code with the |
This change is based on the following two observations:
CopyToOutputDirectory
property instead of build actions to copy contents, the copied files are automatically cleaned up by the build system during clean/rebuild commands. This is especially useful when the names of the copied files change (e.g. when the NuGet package is updated), because old versions of the library are automatically removed the next time a project is built.I tested the functionality of the *.props mechanism locally by manually updating the contents of the .nupkg file and installing it into projects locally. This means the following very important items have not been tested yet.