Comments (7)
It's interesting one.
The key to the problem is understanding why TeamCity prevents WiX source generatione. And another question is why is it a problem.
Wix# compiler will always generate *.g.wxs files if it was invoked with /MSBUILD param. And the out dir is a relative path (./wix) with respect to the CurrentDir. Both command line param and CurrentDir are set by the MSBuild via WixSharp.targets:
<Exec Command=""$(TargetPath)" "/MSBUILD:$(ProjectName)"" WorkingDirectory="$(ProjectDir)"/>
If TeamCity does not fully respect MSBuild runtime model and tweaks with the environment (e.g. sets its own CurrDir) the generation of *.g.wxs can be compromised. Thus in your case the files may still be generated but not in the place you expect. Solution (if this behavior needs to be solved) is to ensure TeamCity executes msbuild target (WixSharp.targets) correctly.
Though I am not sure that *.g.wxs files is a problem. These files are marked in the "no action". Thus their absence does not affect the build outcome at all.
Thus I am afraid you need to do some TeamCity investigation.
If you hit the wall you can always get rid of WixSharp.targets and do the build an old fashioned way. Have just an ordinary ConsoleApp project, add NuGet WixSharp.bin and add post-build event:
This is effectively what WixSharp.targets does.
from wixsharp.
The workaround I just found: make sure your folder wix\ exists under your project (e.g. have it created prior to invoking msbuild) - then the Wix# generated exe will indeed always produce the .g.wxs file, and things work. If the folder wix\ is not there neither it or the .g.wxs file will be created. This way you can mark the .g.wxs to be gitignored.
I am very far from being an expert in VS matters, but this smells like as if the generated exe would not be creating the wix\ folder, merely using it (by putting the .g.wxs file there). And that makes me wonder how the item in the ItemGroup: < None Include="wix$(ProjectName).g.wxs" /> got to my .csproj file. Is that something that gets added when you include the Wix# NuGet packages somehow, together with the WixSharp.targets? Could the difference be that VS re-creates wix\ folder if missing, and msbuild does not?
from wixsharp.
Excellent. Thank you for sharing.
The problem was caused by the Wix#-MSBuild building algorithm not recreating the wix
folder if it was deleted for whatever reason.
The problem has been fixed in the latest Release v1.4.0.
A new settings has also been introduced to allow extra MSBuild control. Now you can suppress *.g.wxs generation when required (e.g. TeamCity builds):
static void Main()
{
// suppress generation of .\wix\MyProduct.g.wxs
MsBuild.EmitAutoGenFiles = false;
...
from wixsharp.
And that makes me wonder how the item in the ItemGroup: < None Include="wix$(ProjectName).g.wxs" /> got to my .csproj file. Is that something that gets added when you include the Wix# NuGet packages somehow, together with the WixSharp.targets?
Correct. And now you can control the inclusion with the it with the MsBuild.EmitAutoGenFiles
setting:
static void Main()
{
// suppress generation of .\wix\MyProduct.g.wxs
MsBuild.EmitAutoGenFiles = false;
...
from wixsharp.
Hi Oleg,
Thanks a lot for fixing the issue!
I can now ignore *.g.wxs files without breaking TeamCity builds, that's a good news.
from wixsharp.
Not a problem,
It was dosarf
who identified the cause of the problem. Most likely TeamCity does some sort of directory clearing and removes the wix
folder.
Keep in mind that MsBuild.EmitAutoGenFiles
just ste's/gets a process envar WIXSHARP_SuppressMSBuildAutoGenFiles
and nothing else.
Thus you can remove MsBuild.EmitAutoGenFiles
from your code and set the envar globally (e.g. on TeamCity build PC):
set WIXSHARP_SuppressMSBuildAutoGenFiles=true
This in turn will unconditionally suppress the *.g.wxs creation for all Wix# projects on your build PC and yet if the same code is compiled on a dev PCs a *.g.wxs will be generated to assist you with the development.
from wixsharp.
Thanks Oleg, for fixing the issue promptly.
from wixsharp.
Related Issues (20)
- set Wix Toolset version for WixSharp HOT 5
- Duplicate component IDs are added when shortcuts are added HOT 4
- Fonts are not installed for all users HOT 4
- Custom Behavior for "X" button in the title bar HOT 3
- Cannot build .net 8 example project HOT 9
- Tags are wrong in git HOT 2
- "Complete" feature gets added automatically & after installation of MSI, an empty feature folder installed even if it is not selected HOT 14
- installDir variable erased depending on ManagedProject structure HOT 5
- Shortcut "Target" produces unexpected results for many supported WiX environment constants HOT 4
- (Race condition?) Issue with form load order (difficult to reproduce) HOT 5
- > since I know now root cause of my issue, how can I include sub folders in my new Files constructor or somewhere in Files HOT 3
- Dotnet tool should not be relied on for wixsharp. HOT 1
- Info: SFXCA: Failed to create temp directory. Error code 5 HOT 1
- How to execute rollback imeediately If i click on cancel after install execute sequence has started ? HOT 3
- Overview of which SetupEventHandler is fired on which type of project HOT 2
- Wix Woolkit 3.14.1 not working "SFXCA: Failed to create temp directory. Error code 5" HOT 1
- MSI build is failing with failed to add file - Even path is available HOT 7
- How to see in WixSharp project which Wix toolkit version is being used AFTER it has been created? HOT 3
- Restart Office apps after installation HOT 23
- Build issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wixsharp.