I have a project that includes a windows installed XML project that builds an MSI. This source works fine in 32 bit platform computers where you can build the solution easily. But when trying to build the source in 64 bit platform computers an error occurs in WIX project. Following is the error.
What makes WIX project throw this error ? Do WIX support 64 bit MSI creation ? ( I'm using Visual Studio 2012 )
WiX supports creating a 64 bit MSI, however you have to alter the csproj file for WiX if you are using the WiX projects created by the WiX toolset. Where normal projects would let you open properties and set the Platform, the WiX projects do not, through the GUI anyways.
Below will allow the project to compile in x64 (I don't support x86, so I don't setup both).
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
Related
Long story made short, how can I change the icon for a console app in VS Code (.Net 5)? Does it have to be done in the .csproj file? Or is there a command or wizard to do this?
You could use:
<PropertyGroup>
<ApplicationIcon Condition=" '$(Platform)' == 'x86' ">x86.ico</ApplicationIcon>
<ApplicationIcon Condition=" '$(Platform)' == 'x64' ">x64.ico</ApplicationIcon>
</PropertyGroup>
Edit: Although, when you compile your application, you have the option to choose an icon for it.
I have a project that is using NuGet packages. It also needs to target different framework versions per build config. I have them laid out in my csproj file something like this:
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '2018|x64'">
<OutputPath>..\BuildFolder\2018</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == '2019|x64'">
<OutputPath>..\BuildFolder\2019</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
I have more build configs than that, but those are examples where I have two different frameworks. The issue is that when I try to batch build the project with all release configs half of them fail depending on what my current config is. Using the two above, I can switch VS to my 2018 configuration and do a NuGet restore, then batch build both and 2018 will work and 2019 will fail with a 'Your project does not reference .NET Framework 4.7' errors. If I then switch to the 2019 config and do a NuGet restore and then try to batch build I get the reverse; 2019 works and 2018 tells me 'Your project does not reference .NET Framework 4.6.1'.
I also tried to put in the 'TargetFrameworks' object in the csproj file but then VS just spins and spins on opening and never opens the project.
How do I get this to work and recognize it to build all configs in batch? I suppose I could build them individually and will have to for now but that seems laborious and unnecessary...
In my current project I need to use the Windows Media Transcoding API. However, I can't manage to install it.
Here you can see I'm using the correct namespace.
using System.Windows.Media.Transcoding;
I looked around on NuGet, but couldn't find it there. I read the Microsoft page about it, but that only told me the namespace. I also couldn't find it's Assembly. Could someone please help me install it.
You can follow these instructions:
Modify the target platform by opening your .csproj file with an external editor and add the line
<TargetPlatformVersion>8.0</TargetPlatformVersion>
as for this example
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6D41F51D-5A85-4826-9868-14FB3591F280}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WindowsFormsApplication1</RootNamespace>
<AssemblyName>UseWindowsMediaTranscodingAPI</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
Reload the solution and add a reference to Windows Core Media DLL
This should already compile.
Additionally to be able handle events and async methods mapping you should add the reference to the system dll:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Runtime.InteropServices.WindowsRuntime
Remember that the application will work only on Windows 10.
Source: https://blogs.msdn.microsoft.com/cdndevs/2013/10/02/using-windows-8-winrt-apis-in-net-desktop-applications/
I am trying to setup a C# project that is compatible with both Windows 10 / Visual Studio 2015 and Ubuntu 16.04 / MonoDevelop.
In the MonoDevelop project options, I set the target framework to Mono / .NET 4.5 and configuration to Debug|x86.
The .csproj file now looks like this:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{myprojectsguid}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>myproject</RootNamespace>
<AssemblyName>myproject</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
When I build, I get this message:
Erzeuge Projektmappe: myproject (Debug|x86)
myproject (Debug|x86) wird erzeugt
Build started 26.05.2016 22:05:49.
__________________________________________________
Project "pathto/myproject.csproj" (Build target(s)):
Target PrepareForBuild:
Configuration: Debug Platform: x86
Target GenerateSatelliteAssemblies:
No input files were specified for target GenerateSatelliteAssemblies, skipping.
Target GenerateTargetFrameworkMonikerAttribute:
Skipping target "GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
Done building project "pathto/myproject.csproj".-- FAILED
Build FAILED.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:00.0785520
--------------------- Fertig ---------------------
Erzeugung erfolgreich.
The message seems to contradict itself. The English part says "build failed", while the localized/German part says "build successful". But no executable was created.
I did not find any applicable information about GenerateSatelliteAssemblies or GenerateTargetFrameworkMonikerAttribute.
Do I need to change the project settings even further? Do I need to supply some missing files?
Update:
Apparently, some packages were missing. So I ran sudo apt-get install mono-complete. Now the project builds successfully.
Though, the notifications about GenerateSatelliteAssemblies and GenerateTargetFrameworkMonikerAttribute are still there. Looks like they don't break the build. I still wonder what they mean.
(I'm just posting the answer that the asker wrote in the question.)
For the asker, it turned out that some packages were missing. The asker ran sudo apt-get install mono-complete, and then the project would build successfully.
I'm working in VS 2013 with a C# Xamarin iOS project. I would like to add a Conditional compilation symbol without effecting anyone else or having to go into Configuration Manager and say copying Debug (primarily so that if someone modifies Debug I don't miss the change).
I've read a few posts stating to try adding something like this to the csproj.user file ...
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>$(DefineConstants);__MY_NEW_SYMBOL__</DefineConstants>
</PropertyGroup>
... but this just removes all the other symbols for the project.
Is there a way I can modify the csproj.user file to achieve this?
I see this is a really old question. I'm not sure if anyone is actually using VS 2013 anymore, but it works in VS2017, exactly the way it's done in the question.
But! I had to run Build -> Clean Solution first before it worked. 'Rebuild Solution' didn't even do it. I had to Clean first, then build and run it.
I tested it with this code:
#if DEBUG
Console.WriteLine("DEBUG");;
#endif
#if TRACE
Console.WriteLine("TRACE");
#endif
#if __MY_NEW_SYMBOL__
Console.WriteLine("__MY_NEW_SYMBOL__");
#endif
Even though my .user file only defines __MY_NEW_SYMBOL__, I saw all three in the console after running it.
My .csproj file has this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
And my .csproj.user file has this:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DefineConstants>$(DefineConstants);__MY_NEW_SYMBOL__</DefineConstants>
</PropertyGroup>