msbuild

MSBuild: Compare ItemGroups or access by index

ⅰ亾dé卋堺 提交于 2021-01-28 19:22:09
问题 For a C++ project, I want to autogenerate a defs.h file with project definitions, such as the date, git commit, ... to automate the versioning process of my application. Therefore I am trying to create a MSBuild Target that will extract the latest git tag, git commit, and the current date and save it to a temporary gitinfo.txt file. Another build target will depend on that file and generate a .h file. In order to avoid unnecessary recompiles of my project, the .h file and for that reason the

Assembly binding added in compiled output (app.config)

我怕爱的太早我们不能终老 提交于 2021-01-28 07:31:38
问题 If I compile my application, an assembly binding is added automatically in the output. The specific assembly binding is not in the app.config in Visual Studio but in the created application config. Is there any way, to check why the assembly binding is added automatically? The option AutoGenerateBindingRedirects is not enabled. I don't want to have the following assembly binding <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.IO

I created a new project in VS 2019 and it doesn't compile because VS fails to find Toolset v142

左心房为你撑大大i 提交于 2021-01-28 06:20:26
问题 The 'template' for the new project is MFC Dynamic Link Library. The problem seems to boil down to Visual Studio looking for the folder "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\v142" - which doesn't exist. I have run and re-run the Visual Studio installer - always adding more things for toolset v142, but nothing seems to help. Is there some way to get this folder to appear? With the right stuff in it? In reality, I am upgrading an existing

How to reference a project out of solution?

浪子不回头ぞ 提交于 2021-01-28 03:51:46
问题 I have a Visual Studio C# solution which consists of some projects. One of the projects needs to reference another project which is not part of the solution. At the beginning I was referencing dlls: <ItemGroup> <Reference Include="ExternalProj1, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Proj1\ExternalProj1.dll</HintPath> </Reference> </ItemGroup> However I must reference projects so that those will generate their

How to reference a project out of solution?

爷,独闯天下 提交于 2021-01-27 23:59:30
问题 I have a Visual Studio C# solution which consists of some projects. One of the projects needs to reference another project which is not part of the solution. At the beginning I was referencing dlls: <ItemGroup> <Reference Include="ExternalProj1, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\Proj1\ExternalProj1.dll</HintPath> </Reference> </ItemGroup> However I must reference projects so that those will generate their

How do you specify command line arguments in a .csproj's StartProgram setting?

喜欢而已 提交于 2021-01-27 16:00:29
问题 I'm trying to specify command line arguments to an executable in a <StartProgram> value of a <PropertyGroup> Currently looks like this <PropertyGroup> <StartAction>Program</StartAction> <StartProgram>$(SolutionDir)\Edge.Express\node.exe</StartProgram> </PropertyGroup> I'm trying to automate the steps involved in attaching my library to a running process so my team can directly debug a library without additional ceremony (They're not familiar with Visual Studio yet) I copied the node

How do I use the clang static analyzer with msbuild on Windows?

空扰寡人 提交于 2021-01-27 10:22:35
问题 The binary windows installer for clang includes scan-build but when you run it with msbuild nothing happens. Even if I do something like: "C:\Program Files\LLVM\bin\scan-build.bat" "C:\Program Files\LLVM\bin\clang.exe" test.cpp I get something like: scan-build: Using 'C:\Program Files\LLVM\bin\clang.exe' for static analysis scan-build: Removed Directory '....' scan-build: No Bugs found Where test.cpp is: void DivideByZero(int z){ if (z == 0) { int x = 1 / z; } } int main() { int *i = nullptr;

How do I use the clang static analyzer with msbuild on Windows?

a 夏天 提交于 2021-01-27 10:19:33
问题 The binary windows installer for clang includes scan-build but when you run it with msbuild nothing happens. Even if I do something like: "C:\Program Files\LLVM\bin\scan-build.bat" "C:\Program Files\LLVM\bin\clang.exe" test.cpp I get something like: scan-build: Using 'C:\Program Files\LLVM\bin\clang.exe' for static analysis scan-build: Removed Directory '....' scan-build: No Bugs found Where test.cpp is: void DivideByZero(int z){ if (z == 0) { int x = 1 / z; } } int main() { int *i = nullptr;

Error: The element <ParameterGroup> beneath element <UsingTask> is unrecognized

核能气质少年 提交于 2021-01-27 07:03:13
问题 I am receiving this error, when building the solution using the msbuild. The element <ParameterGroup> beneath element <UsingTask> is unrecognized. The error is showing both in msbuild and in Visual Studio. 回答1: This is because one of your project is targeting .NET 3.5. All of your projects should be targeted to .NET 4.0 at least. If your .cs project does not allow to view or change the Target Framework, as it was in my situation: You will need to change it manually in .csproj. Open the

Error: The element <ParameterGroup> beneath element <UsingTask> is unrecognized

梦想的初衷 提交于 2021-01-27 07:00:06
问题 I am receiving this error, when building the solution using the msbuild. The element <ParameterGroup> beneath element <UsingTask> is unrecognized. The error is showing both in msbuild and in Visual Studio. 回答1: This is because one of your project is targeting .NET 3.5. All of your projects should be targeted to .NET 4.0 at least. If your .cs project does not allow to view or change the Target Framework, as it was in my situation: You will need to change it manually in .csproj. Open the