Release build not available WPF - c#

I am writing a fairly simple WPF desktop application and under build\configuration manager, release is not an option. The only available options are Debug, New, and Edit.
Anyone have an idea on why this is?
Related: the control library in the same solution does have release as a build option. It is only missing in the wpf app.

I figured it out.
To fix i copied the propertygroup tag for release build from the xml in the other project to the project that was missing it.

The propertygroup tag thing does fix the problem.
1) Open your project file in notepad.
2) Paste this after the "debug" propertygroup tag:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>

Related

No project Type Guid in .CSProj file

This is my first time when i came across something like this. For the longest time whenever I want to precisely know the type of the project I use the guidance provided in the link below:
How do you tell the Visual Studio project type from an existing Visual Studio project
And it has been working great for me so far. However, I came across a project where there is no mention of the ProjectType. Below is the XML of .csProj file for the reference.
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{87F6C2DE-6074-4E6D-9854-51EC812F7548}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PL.HR.Services.Employee.DAL</RootNamespace>
<AssemblyName>PL.HR.Services.Employee.DAL</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
I am not sure how can this happen
Is it possible without anyone manually removing the type information from .csproj file?
If not, then under what circumstances does it happen in VS?
Is there anything that we can do to prevent this kind of occurances from happening in the future?
Are you just looking at the xml or are you actually using VS provided services to get this information?
is it really a valid .csproj? or is it just something named .csproj so VS opens it? does VS actually open it without errors?
Some types of projects do not use project type guids as xml elements in a project file, like C++ projects, but then those generally don't end with .csproj. Those types of projects may be implemented in other ways, which implement things in IVsHierarchy and IVsAggregatableProject so you need do to it from code, like one of the pages from your linked answer explains.

Symbol status showing "Skipped Loading" for dll in modules window?

I've recently upgraded some solution(s) to Visual studio 2013. All went OK apart from one which now generates the:
Symbol for the modules 'name' were not loaded.
...error every time I run it.
When I look in the modules debug window I can see against the dll (It's a web service dll)
Name Path Optimised User Code Symbol Status
dllName.dll Tempoary ASP.Net...etc. Yes No Skipped Loading...
If I look in the \bin I see the dll and it's coresponding .pdb file.
Checking the build menu for the project I can see Debug Info: full.
Cut a long story short everything looks fine to me except that it's not loading any symbols.
Any idea what I'm missing?
Update
It looks like if I run my solution though IIS express the issue goes away. But running though IIS (8) I still have this problem.
After painfully comparing two project files, one that worked and one that didn't I noticed that the proj that worked had:
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
**<Optimize>false</Optimize>**
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Where as my one had
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
**<Optimize>true</Optimize>**
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
By setting the <Optimize> property to false all issues went away.
This answer also seems relevant as the .csproj.user file can be out of sync, I deleted it.

Change Sitename/Applicationname causes MsBuild failure

I am using MVC3 application,and am creating packages through TFS build.it was working fine when i am creating Packages through MSBuild.
Previously Website1 has my application(Website1/Application) in IIS,now i want to relocate my Application under Website2,like(Website2/Application),in the Package/PublishWeb properties.
But my TFS(MSBuild) Build was failed with following error
C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets
(3847): Web deployment task failed. (Site 'Website2' does not exist.).
do i need to change may Sitename any other place? Please help us to fixing this issue.
My configuration
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DeployOnBuild>true</DeployOnBuild>
<DeployTarget>MsDeployPublish</DeployTarget>
<MSDeployPublishMethod>InProc</MSDeployPublishMethod>
<CreatePackageOnPublish>true</CreatePackageOnPublish>
<MsDeployServiceURL>localhost</MsDeployServiceURL>
<DeployIisAppPath>Analytics/Application</DeployIisAppPath>
</PropertyGroup>

Can Conditional compilation symbols be added to csproj.user file?

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>

C# project additional output path

In project file, normally we can see the following for setting the project output path. Now I am wondering if there is a way to set additional output path. i.e., the built binaries will be copied to the additional path as well.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
It would be trivial to add a post-build event to your project/solution configuration, which copies the files from the original build location to your specified new one. Go to your project properties, and under "Build Events" add the following to your post-build event command line:
xcopy /E $(ProjectDir)bin\Release\ [pathToMyDestination]
As an aside, I'm guessing you want to publish your release build to a host. In that case it's worth looking into continuous integration software, which gives you powerful capabilities. We've used several and are currently using Team City (free).

Categories