ExePackage SourceFile is copied to development folder - sql-server

The question here indicates that when an ExePackage has DownloadUrl it also needs a copy of SourceFile.
We keep the copy of the Sql Server Setup in a separate Release folder that is not part of the development environment. We do this so our daily backup doesn't have to copy the same 300+MB every time.
However, when Burn builds our Setup, it copies the SourceFile to the output folder along with the .exe it creates. The filename is the DisplayName and the file is the same size as the file in the Release folder.
The result is similar to setting CopyLocal on a project reference.
Can I tell Burn not to copy this file on build?
Edit
I am deleting the file with the post-build event in Visual Studio. However, this doesn't answer the original question.
Further Information
After I delete the file and run the Setup, I get an error in the MSI log: Failed to resolve source for file.
This happens at run-time, and the file referenced is located in the project output folder. How is it possible that Burn is looking at the source file at run-time?

That question also mentioned that it if you provide the RemotePayload element, then it doesn't need the SourceFile. So use RemotePayload so that it never copies it.

Related

Get direct path of database.mdf from project folder - file moved

I'm trying to get the direct path of my local database.
I put the database inside my main project folder:
Then I used this code to get the path:
Dim cn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=" + My.Application.Info.DirectoryPath + "\database\database.mdf;Integrated Security=True;User Instance=True")
Everything is OK now.
So why is the database copied into the \bin\Debug folder?
Then if I open the source code and run the project and try to save data or find data that I saved before from the application in \bin\Debug I don't find it? Why?
What I mean
If I run the project from \bin\Debug its will save
If I run the project from project1 folder from (.sln) and try to show the data table I don't find may saved data.
The opposite is true
Here's how it works. You add a data file to your project and it is a source file. You build your schema in that file and you also add any default data to that file. You don't use that file for testing and debugging though. How would it make sense to pollute that file with test data and then you've got no clean database to deploy with your application when you release it?
When you build, that source file gets copied to the output folder. If you build a Debug version, the data file gets copied to the Debug folder and that's where you mess it up with your test data. When your application is ready to deploy, you switch to a Release build and a nice clean copy of your source database is created in the Release folder.
By default, the Copy to Output Directory property of that source file is set to Copy Always. That means that any time you run your project and there are changes to any source file, a new copy will overwrite the one already in the Debug folder and any changes you made last time you debugged will be lost. If you change that property to Copy if Newer, a new copy will only be made if you change source data file. That allows you to keep changes between debugging runs. To force a refresh, just do a Clean or delete the copy manually.

MSDeploy Auto Generated deploy.cmd path issue?

I've been working on trying to figure out why our auto-generated deploy.cmdscripts will not work when installed to C:\Program Files (x86)\OurProgram. I finally narrowed down the issue to the closing parenthesis in (x86) as the script would terminate with "Files was unexpected at this time". One possible solution was to manually create another batch file to set _DeploySetParametersFile to a Windows path ( C:\Program^ Files^ (x86^)\OurProgram\Program.Parameters.xml). This isn't a valid solution for me, so I dug into the auto generated file and found the issue to be 2 variables:
RootPath
_DeploySetParametersFile
Both of which were referenced using %'s(i.e. %RootPath%), however as soon as they were changed to !'s(i.e. !RootPath!), no 2nd script was needed and I can run the cmd script from Program Files (x86) just fine. The issue of course with this is, the deploy.cmd file is auto-generated on each build, thus I have to change it for each build I do. My question is this: Is there a way to edit the template Visual Studio uses to generate the deploy.cmd file? If so, where? It seems so ridiculous that Microsoft would have this be an issue in their web deployment.

How to archive new build files in jenkins -pipeline script in groovy ReactJS

trying to archive all the files into a zip file that is formed in the workspace in jenkins pipeline script. I tried using this
archiveArtifacts 'C:\Program Files (x86)\Jenkins\jobs\pipeline CI_MS\workspace'
but error was shown as "file not found"
Thanks for any help
Do you really want to archive everything in the entire workspace? Hardcoding the path like that is a bad idea. The workspace moves, and if you are using a more recent version of Jenkins (that wasn't upgraded from an old version), you are probably not even looking in the right space.
Use this:
archiveArtifacts "${WORKSPACE}"
Add to the end of the path if you want to archive files in subdirectories.

WPF CodedUI Tests - how to stop test agent deploying a specific file?

Firstly, apologies if this has already been asked. I searched, but couldn't find anything specifically relating to this problem...
I'm having a big issue with CodedUI. In my case, I deploy my software to an environment, and then run the automated tests via visual studio on this environment. As the test starts, the test agent appears to copy files as it wishes into a temporary directory from which to run the tests, as suggested on this page:
https://msdn.microsoft.com/en-us/library/ms182475(v=vs.100).aspx
The following files and folders are copied to the deployment folder
before the tests are run:
•The test assembly file
•All dependent assemblies
•Files that you have specified, such as XML files and configuration
files, on which tests depend. You can configure deployment both by
specifying additional deployment items to be copied and by changing
the deployment folder.
My issue with this is that my tests reference a file that is present on my environment. Into the directory
"C:\Program Files (x86)\Common Files\Microsoft
Shared\VSTT\12.0\UITestExtensionPackages"
I have placed an extension package that allows me to interface with some third-party WPF UI components. This is in place on the environment, and my test projects within Visual Studio all reference the file in that location as a dependency, and have "Copy Local" set to false and "Specific Version" set to true.
The problem occurs when the test agent starts the tests, and copies all of the files it thinks it requires to the temporary test directory. It also copies this extension file, resulting in every test failing with the error:
System.InvalidCastException: [A]<type here> cannot be cast to [B]<same
type here>
As it appears to be referencing the one I intentionally placed there as well as the one the agent copied over. If I manually go in and remove the file, then tests will start to pass.
My question is: how do I prevent the test agent from copying this file? I know the file will always be in the location which I placed it and do not require it to be copied over.

Run .bat as a Windows Service

I'm here again with another case that is getting me out my mind.
So, this is happening, I'm trying to run an executable java class(.jar) as a Windows Service, and all my attempts failed so far. To make it a little easier, I turned my jar into a batch file, wich only executes the jar in background, here is the code:
start "" javaw -jar C:\LocalService.jar
The batch works fine. However I have tried to install this batch as a service by using the next line in cmd:
sc create "LocalService" binPath= "C:\LocalService.bat"
The Service installs correctly, but as soon as I try to start it, it pops up an error (The code error is 1053, says something about the service did not start correctly)
Also, I have try with a software called NSSM (non-sucking service manager) It installs fine too, but the service does not start either.
Do you guys know what am I missing?
By the way, I'm doing all this on Windows 7 Professional.
Thanks!
thanks for your comments
Both tools didnt work for me, sadly. However I was able to do it with a software called Java Service Wrapper. This is not a free software, so I needed to buy a license to get it to work.
The steps were simple:
1.-Create a folder with the name of the service, then inside add 4 folders: lib,bin,logs,conf
2.-On the lib folder you have to copy your jar and also the wrapper.jar and wrapper.dll (these last two are in the zip you download from the website)
3.-Copy 4 files to the bin folder: InstallApp-NT.bat.in, App.bat.in, UnintstallApp-NT.bat.in and wrapper.exe (this last one is the one that defines your license, if you can get a file wrapper.exe from somebody else who had paid a license it will work fine. These file also came in the zip from the website) Remove the .in from the batch files
4.-The most tricky step is this: You have to copy from the wrapper's folder called conf a file called wrapper.conf.in Remove the .in extension and edit it with a tex editor. The most important lines you have to edit are:
wrapper.java.command=C:\Program Files (x86)\Java\jre7\bin\java //Specify JRE Path. Will work with eviroment variable
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperJarApp //Choosing this class means your are using a .jar file to execute when the service starts
wrapper.java.classpath.1=C:\LocalService\lib\wrapper.jar //This one is constant.
wrapper.java.classpath.2=C:\LocalService\lib\LocalService.jar //This is the path to your executable jar
wrapper.java.library.path.1=C:\LocalService\lib //Path to your own lib folder (the you created at the begining)
wrapper.app.parameter.1=C:\LocalService\lib\LocalService.jar // again the path to your jar
Then just execute the InstallApp-NT.bat and start the service and your are done
It worked to me with absolute paths, however according to documentation it will work fine with relative path too.
This is how I solved my problem and I hope someone with the same issue will find this helpful
See you next time!

Resources