Files needed to run a standalone exe built with wxWidgets - wxwidgets

I have built an EXE with wxWidgets 3.1.4 under Visual Studio 2017.
I can start the EXE from Visual Studio but not outside Visual Studio.
I get the message:
Unhandled unknown exception; terminating the application.
EXE is built in Release/x86.
I have tried to copy the Release DLLs of wxWidgets in the same folder as the EXE as well as files from vc_redist_x86 but I still get the error.
Thanks for your help

It was an application error, a resource file was missing.
I have deleted the Release folder, rebuilt and copied the resource file and the EXE runs.
Release DLLs are in my %PATH% and I have installed vc_redist_x86.exe so I guess these two things allow my standalone EXE to start.

#MaximeVermier,
In order to build the library yourself:
Open ${WXWIN}\build\msw\wx_vcN.sln.
Select Build->Batch Build...
Select all project which says "Debug/Win32"
Click "Build".
The resulting libraries will be in ${WXWIN}\lib directory.
Now all you need is to change the project file for your application and rebuild.
Then you will not need wxWidgets DLLs.

Related

How to use msbuild to generate a VS .sln file where everything is on x64 platform?

When I build my project in command line, everything works fine. But when I tried to generate a .sln file for the project by running msbuild /t:SlnGen /p:Platform=x64
at the command prompt, and then click build in VS (debug, x64), I got an error saying it can't copy a dependent binary folder because it is not found. Since my project is on CBT, I have x64, x86 and Any-CPU platform settings. My project used to be built on CoreXT. My suspicion is VS build doesn't handle the output path of the dependencies correctly.
Then how can I build the solution only on x64 through VS?
Any hint will be very helpful!

Cannot build .net core 1.1 with msbuild tools

I have a .net core class library I am attempting to build into a nugget package. however, on my build server (running team city), I am getting the following error:
C:\TeamCity\buildAgent\work\3c6531587491c25e\MySolution\MyProject.csproj
error MSB4019: The imported project "C:\Program Files (x86)\Microsoft
Visual
Studio\2017\BuildTools\MSBuild\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props"
was not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
When I look in this directory, I ma missing the "Microsoft.NET.Sdk" folder from my build server. where do I get these tools without having to install visual studio?
Thanks!
See the tracking issue on GitHub: https://github.com/Microsoft/msbuild/issues/1697
If you don't want to touch your build tools installation (by copying SDK files), you can also set the MSBuildSDKsPath environment variable to the location of the SDKs carried in the .net CLI (usually C:\Program Files\dotnet\sdk\1.0.0\Sdks\)

wxWidgets with visual studio 2015

I finish installing wxWidgets and build accordingly it give no problem.
I started a new project and adding the path to library and include and build this project it gives no problem, it works very well.
But When I run it give the error as wxbase31ud_vc_x64_custom.dll missing but actually this dll is there in the library folder.
what to do?
Help me to resolve this problem.
In order to load, a DLL must be in the application load path. It is not sufficient for it to be in the same directory as the import library. The safest thing to do is to place the DLL files in the same location as your executable. My personal preference is to statically link wxWidgets.

TeamCity build fails without windows kits reference in proj file

I'm having an issue on teamcity (9.1.7). I don't have visual studio installed on the build server. I have installed visual studio test agents and msbuild tools. Building one of the project fails with this error-
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\AppxPackage\Microsoft.AppXPackage.Targets(694, 9): error APPX1639: File 'Windows.props' not found. See http://go.microsoft.com/fwlink/?prd=12395&pver=1.0&plcid=0x409&ar=MSDN&sar=PlatformMultiTargeting&o1=Portable&o2=7.0 for more information
The link doesn't work. After looking up the error, it seems i need to install Windows Kits and I need to add this to my csproj file under the first property group -
<_WindowsKitBinPath>C:\Program Files (x86)\Windows Kits\8.1\bin\x86</_WindowsKitBinPath>
<_WindowsPhoneKitBinPath>C:\Program Files (x86)\Windows Phone Kits\8.1\bin</_WindowsPhoneKitBinPath>
<MakePriExeFullPath>$(_WindowsKitBinPath)\makepri.exe</MakePriExeFullPath>
<MakeAppxExeFullPath>$(_WindowsKitBinPath)\makeappx.exe</MakeAppxExeFullPath>
<SignAppxPackageExeFullPath>$(_WindowsKitBinPath)\signtool.exe</SignAppxPackageExeFullPath>
<MakePriExtensionPath>$(_WindowsPhoneKitBinPath)\x86\MrmEnvironmentExtDl.dll</MakePriExtensionPath>
<MakePriExtensionPath_x64>$(_WindowsPhoneKitBinPath)\x64\MrmEnvironmentExtDl.dll</MakePriExtensionPath_x64>
I really don't want to add this to my csproj file. I don't know why it is required/what impact it has. Can someone explain to me why this is needed? When i build my solution locally with visual studio, it works fine.
The groups of settings are basically bootstrapping parameters that are required by MSBuild in order to compile the project (A native windows phone app??). You've probably got the kit installed locally and something already integrated into Visual Studio, which is why it builds. Uninstall the Visual Studio add-in and it'll probably start failing.
You can setup your compile step to pass in these parameters without requiring them in the .csproj file if you don't want them there.
I normally abstract additional build parameters to a variable in TeamCity
Hope this helps

WCF compilation error on CI server: Microsoft.VisualStudio.ServiceModel.targets not found

I am getting this error on my CI server:
error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF\Microsoft.VisualStudio.ServiceModel.targets" was not found
It seems my WCF service library project references that file, but the VisualStudio folder on Program Files\MSBuild\Microsoft doesn't contain a WCF folder.
I guess I need to install something on the server.
What do I need to install?
Well this ruined my morning, but let's not allow it to ruin anyone else's. I couldn't find this information anywhere else. You need to copy a few files from a development machine with VS Pro 2012.
As aphexddb mentions, you need to copy some targets from C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF to the same location on your CI server.
This then references an assembly called Microsoft.VisualStudio.ServiceModel.Core. You can find this assembly in either the GAC or in the IDE directory at C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE.
Copy this to your CI server and execute gacutil.exe -i Microsoft.VisualStudio.ServiceModel.Core.dll
This was enough to fix it for me.
This isn't the first time I found targets missing from my VS express install in my CI server. I can't help but feel that there is some sort of package I can download from somewhere that fills all this in. Does anyone know of such a thing? If not, perhaps we should create one.
Can still happen on vs2019
error MSB4019: The imported project "C:\Program Files (x86)\Microsoft
Visual
Studio\2019\Professional\MSBuild\Microsoft\VisualStudio\v16.0\WCF\Microsoft.VisualStudio.ServiceModel.targets"
was not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
WCF is not installed by default as part of 'ASP.NET and web development' workload. To fix this,
On visual studio installer > modify > individual components tab, search for wcf, check, modify - the .targets file gets now installed, msbuild builds ok.
MSBuild auto-detection: using msbuild version '16.3.2.50909' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin'
I ran into this with Visual Studio 2017, for me the resolution was to modify my installation of Visual Studio to include the Windows Communication Foundation components.
Extract this file into folder
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF
The file name is "Microsoft.VisualStudio.ServiceModel.targets"
Now you can solve the problem using the Nuget Package MSBuild.Microsoft.VisualStudio.Web.targets
so the build process does not require any change to the build server.
Install-Package MSBuild.Microsoft.VisualStudio.Web.targets
Details:
remove the element for "ServiceModels.targets" in the .csproj file
remove the target WebApplication from the build command (in yaml)
Ran into this same issue. Did the following to resolve:
Installed the Microsoft Web Platform Installer
Copied Directory "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\WCF" from dev laptop with Visual Studio 2012 to the build server
I've had the same error - my issue was that MS has modified the way MSBuild looks for the versions of VS in the build process template.
Make sure to use the right build process template.
If using TFS2013 and VS2013 use TfvcTemplate.12.xaml
I ran into this same error. In my case, the problem was that my Visual Studio 2008 project didn't get upgraded correctly, probably due to files being marked "read-only" by my source control. To fix it, I loaded the solution in Visual Studio 2015 with everything checked out.
The specific line in the .csproj file changed from
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\WCF\Microsoft.VisualStudio.ServiceModel.targets" />
To
<Import Project="$(WcfServiceModelTargetPath)\Microsoft.VisualStudio.ServiceModel.targets" />
If you are using VS 2022 build tools, it is no longer in the individual components section. It is on the first tab "Workloads", included in ".NET desktop build tools", you will see it in the list on the right-hand side when you select it.