I want to build my solution using psake and msbuild (v3.5) on an x64 pc. When I execute the script I get the following error:
error MSB4019: The imported project "C:\Program Files\MSBuild\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.
The message is correct, the file is missing but I have installed the 32 bit version of VS 2008 and therefor it is in the folder 'C:\Program Files (x86)...'
Is there any solution to tell msbuild to use the 32 bit version, not the 64 bit version?
You can specify what framework version is used for build. See $framework variable. In your case you need $framework = '3.5×86' at the beginning of the script.
Related
I am trying to publish a new version of a Powershell module to the Powershell Gallery by using
Publish-Module -Name "Nuttercode-PRTG" -NuGetApiKey $apiKey -Verbose -RequiredVersion 1.4
The module .psm1 and .psd1 files can be found here.
After dotnet.exe created the package in {myUserDir}\AppData\Local\Temp\{random numbers}\Nuttercode-PRTG it reports:
VERBOSE: finished running C:\Program Files\dotnet\dotnet.exe with exit code 0
VERBOSE: Created Nuget Package
VERBOSE: Successfully created nuget package at
Write-Error: Failed to publish module 'Nuttercode-PRTG': 'Cannot bind argument to parameter 'NupkgPath' because it is an empty string.'.
Afterwards the temp-folder gets deleted. To me this sounds like an internal problem of Publish-Module or dotnet.exe, but I have no idea what is going on or if I am doing something very wrong myself. I also created a new api key just in case but it did not affect the result.
I am using Windows 10 20H2 (Build 19042.1469), Powershell 7.2.2, PowerShellGet 2.2.5, and dotnet.exe 6.0.201. I am able to replicate the problem on another computer using the same command and arguments using Windows 11 21H2 (Build 22000.556), Powershell 7.2.1, PowershellGet 2.2.5, and dotnet.exe 5.0.102.
I'm trying to build Qbs example collidingmice on Windows 10 x64 and got the following error message:
Qt5Cored.lib(Qt5Cored.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
I tried setting the following in the collidingmice.qbs
qbs.architecture : "x64"
and got the message
'x64' differs from the architecture produced by this compiler (x86)
I then tried
qbs.architecture : "x86_64"
which gives the error message;
'x86_64' differs from the architecture produced by this compiler (x86)
I then tried
qbs.architecture : "x86"
which gives the error message;
Qt5Cored.lib(Qt5Cored.dll) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
Is there a way to set target machine type e.g. to 'x86' or 'x64' in Qbs?
My guess is that you are using an x86 compiler and an x64 Qt, which will not work. How did you set up your profile?
Here's how I fixed the same issue when building an application using the Qbs build system ("Tiled", the game tilemap editor). In my case I am using the Visual Studio 2019 x64 toolchain.
NOTE: This answer assumes that Qt and Qbs are in your PATH.
Open the command prompt
Run "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64 to initialize VS2019 environment variables in your command prompt.
cd to the directory where your .qbs project lives.
cd myproject
Create a new shadow build directory for your build and cd into it.
mkdir build-myproject
cd build-myproject
run qbs setup-toolchains --detect which should find your VS2019 environments.
run qbs setup-qt --detect which should find your Qt environment (assuming you added to PATH).
run qbs config --list profiles to show the detected toolchain profiles.
Example:
qbs config --list profiles
profiles.MSVC2019-x64.cpp.compilerVersion: "19.25.28614"
profiles.MSVC2019-x64.cpp.toolchainInstallPath: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64"
profiles.MSVC2019-x64.qbs.architecture: "x86_64"
profiles.MSVC2019-x64.qbs.targetPlatform: "windows"
profiles.MSVC2019-x64.qbs.toolchainType: "msvc"
...
The MSVC2019 x64 profile is named "MSVC2019-x64". Now specify that via qbs property when building your application like so:
qbs build -f ..\MyAwesomeProject.qbs profile:MSVC2019-x64
Building as x86 can be accomplished in a similar manner, as long as an x86 build of Qt is available. Running the vcvarsall.bat batch file with x86 will set up your command prompt to use the VS x86 environment variables.
I used CakeBuild to build and test my Xamarin Portable Class Library.
In the build.cake script I defined that I want to use the NUnit-Console to run my testcases. So I do
#tool nuget:?package=NUnit.ConsoleRunner
Unfortunatelly I get the following error when I run the Cake script.
Preparing to run build script...
VERBOSE: Restoring tools from NuGet...
VERBOSE: Feeds used:
C:\Users\bergkar\.nuget\packages\
All packages listed in C:\dev\Xamarin\fleetboard-core-library\tools\packages.config are already installed.
Running build script...
Analyzing build script...
Processing build script...
Installing tools...
Unable to find package 'NUnit.ConsoleRunner'
NuGet exited with 1
Could not find any relevant files for tool 'NUnit.ConsoleRunner'. Perhaps you need an include parameter?
Error: Failed to install tool 'NUnit.ConsoleRunner'.
When I add a specific version I want to use like below then everything works fine.
#tool nuget:?package=NUnit.ConsoleRunner&version=3.7.0
Can someone tell me why it is not working without the version stuff?
With ".\build.ps1 -Verbosity Diagnostic" I get the following output:
Preparing to run build script...
Running build script...
Module directory does not exist.
Analyzing build script...
Analyzing C:/dev/Xamarin/fleetboard-core-library/build.cake...
Processing build script...
Installing tools...
Installing NuGet package NUnit.ConsoleRunner...
Executing: "C:/dev/Xamarin/fleetboard-core-library/tools/nuget.exe" install "NUnit.ConsoleRunner" -OutputDirectory "C:/d
ev/Xamarin/fleetboard-core-library/tools" -ExcludeVersion -NonInteractive
Unable to find package 'NUnit.ConsoleRunner'
NuGet exited with 1
Feeds used:
Output:
Feeds used:
Could not find any relevant files for tool 'NUnit.ConsoleRunner'. Perhaps you need an include parameter?
Error: Cake.Core.CakeException: Failed to install tool 'NUnit.ConsoleRunner'.
at Cake.Core.Scripting.ScriptProcessor.InstallTools(ScriptAnalyzerResult analyzerResult, DirectoryPath installPath)
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath, IDictionary`2 arguments)
at Cake.Commands.BuildCommand.Execute(CakeOptions options)
at Cake.CakeApplication.Run(CakeOptions options)
at Cake.Program.Main()
Now I found my problem and solved it.
The problem was that the NuGet.exe did not has a source feed which points to a public nuget source like "https://api.nuget.org/v3/index.json".
This was because my default NuGet.conf in under "C:\Users\YOUR_USER_HOME\AppData\Roaming\NuGet" had no packageSource defined. So Nuget just knows the local nuget package cache under "C:\Users\YOUR_USER_HOME.nuget\packages" and this did not include the specified package.
So after I added a packageSource in "C:\Users\YOUR_USER_HOME\AppData\Roaming\NuGet\NuGet.Conf" everything works fine.
Another way can be to add a new NuGet.Conf beside your build.ps1 file which contains all package sources you need for CakeBuild and your Xamarin project.
The following page explains how Nuget finds its configuration. Maybe this is helpful to understand the mechanism NuGet uses to find its configuration:
https://learn.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior
I am trying to setup build definition in TFS 2015 .WHen i try to setup build ,it's failing and giving below error:
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
12. 2017-03-31T13:59:36.1211815Z ##[error]The given path's format is not supported.
13. 2017-03-31T13:59:36.1368100Z ##[error]Unexpected exit code 1 returned from tool NuGet.exe
I tried selecting restore nuget package as well as everything I could do but I am not getting which path's format is being fetched. Please help me.
This error is similar to Nuget 3.4+ can not restore some packages fails with "The given path's format is not supported"
First, please check nuget.config and make sure nuget can find packages from your sources. Besides if you are using Nuget 3.4.x, give a try with version 3.5.0-rtm-1829
I am using nuget.exe to programmatically package my app with powershell.
The powershell commands I am running are
C:\nuget.exe spec $appName
C:\nuget.exe pack TestApp.nuspec -Version $version
This correctly packs everything in the working directory into the nupkg file, and my binaries show up under "Package contents" correctly...however there are some concerns.
I am seeing these errors in the command window:
Issue: Remove sample nuspec values.
When I open the nupkg in the Nuget package explorer, I see the default tags/description/release notes...etc.
The issue is with the "Dependencies" - it is also including a SampleDependency (>= 1.0.0) which seems to cause issues later on in my pipeline.
Is there a way to blow away that sample dependency through the spec/pack via command line?
Thanks