azure project msbuild is not copying app.config - azure

When deploying an Azure worker role project from Visual studio, everything works fine.
When we build the package using command line msbuild, the apps.config is not copied to project.dll.config.
How can we achieve that?
Note:
the msbuild command builds a cspkg file (which is a zip).
When we open the zip file, project.dll.config is not here.
Config: Visual studio 2013
azure sdk 2.3
Note 2:
When you create an azure solution in visual studio, it creates 2 project:
One Azure project.
One worker role project.
This is the Azure project that is built, and the app.config belongs to the worker role project.
Deploying through Visual studio makes the magic automatically, msbuild.exe does not ( or we don't know how to do it).

Is the App.config correctly specified in your .csproj file? You should have something similar to:
<Content Include="app.config">
<SubType>Designer</SubType>
</Content>
Somewhere in your .csproj file.

Related

How to run/debug Azure Cloud Service locally on Visual Studio Code?

I have an Azure Cloud Service solution in Visual Studio 2017 which I debug with Emulator Express.
I'd like "migrate" from Visual Studio to Visual Studio Code. I mean that I'd like to be able to run/debug my cloud service(web role project) in VSCode without the use of Visual Studio at all.
My solution has two project:
Service project - contains .csdef, .ccproj and multiple .cscfg.
Role project - contains the .csproj file and the rest of the sample web role project.
I've tried:
I'm building both of the projects with msbuild, the same way it's been built in visual studio. The problem is running the site locally.
Run a local site with IIS Express VSCode extension and configure the web role project root as site root. It didn't work, I tried to browse the site but I got a notification that the folder of the site can't be viewed as a directory. When I think of it this option is missing all the configuration that is defined in the Service project so how is it suppose to work? Does IIS Express can run an Azure cloud service app locally? Maybe I configure a wrong path?
I've tried running csrun.exe command multiple times with different arguments. Something like this:
"C:\Program Files\Microsoft SDKs\Azure\Emulator\csrun.exe"
/run:./csx/Debug/roles/WebRoleProject/approot;./ServiceConfiguration.myconfig.cscfg /launchBrowser
/launchDebugger:%systemroot%/System32/vsjitdebugger.exe
It gave me the following error:
The compute emulator had a error: Can't locate service descriptions..
I also saw here that compute emulator(csrun.exe) needs visual studio opened as administrator, so maybe it's not possible to run it without it..
I’ve verified this question with the Azure Cloud Compute team and this is not supported in VSCode, they only built an extension for Visual Studio.

TFS 2012 build copy console application to _PublishedWebsites

I am using TFS 2012 build option to build my web application. I have couple of console application in the solution. I want the console application output to be copied to the bin folder. In visual studio, I am doing this by using the copy command in the Post build event command option. But this does not work in TFS builds. The generated exe is not copied to the _PublishedWebsites folder in the BuildAgent directory
Possibility duplicate to Problems with MSBuild OutputPath and OutDir in TFS2010 .
Also give a try wiht this NuGet package, you can install it which will do this.
With TFS 2012 build process template, you need to custom build process template to run the script after building, like the post-build scripts feature in TFS 2013 build process template.
You can refer to this article to custom build process template to achieve your requirement.

Can I disable SlowCheetah transforms when running non-web application in Visual Studio

I have SlowCheetah as part of my TeamCity build process to transform app.config files.
I know that in the case of web applications, running an application in local Visual Studio debugger does NOT transform the relevant web.config. I presumed this behaviour was the same for app.config files but I just found today that when I run a Console or Windows Service application from local VS 2012 (e.g. in Debugger) the app.config is transformed.
Is there a way to prevent the app.config transform occurring when running a non-WAP project in debugger?
There is an easy way to do this.
Open the csproj file for the project (e.g. Windows Service project) in an editor (You can do right-click|Unload Project in the VS Solution Explorer followed by "Edit Project File" to edit the file contents in Visual Studio).
Look for the line containing the following:
<Import Project="$(SlowCheetahTargets)" Condition="Exists('$(SlowCheetahTargets)')" Label="SlowCheetah" />
and modify it as follows:
<Import Project="$(SlowCheetahTargets)" Condition="Exists('$(SlowCheetahTargets)')and '$(IsDesktopBuild)' == 'false'" Label="SlowCheetah" />
This will disable transforms when you are on your local machine but they will continue to be transformed in a Build Server.

Invoke a publish from msbuild for visual studio 2012

For VS2010 and before I was utilizing Web Deployment Projects (WDP) to help package my website for production deployment. I had a MSBuild script that compiled the solution in release mode. An output of that was production ready website files compiled and cleaned by the WDP.
I see for 2012 WDP have been removed, and a new tab has been created in the properties for the web application. The options are the same, but now the invocation of this is done via the Publish option (before you just compiled in release mode).
So the question is this. From an MSBuild script, how do I invoke a Publish operation? I found some old posts that...
msbuild /target:publish
would do the trick. But that doesn't seem to work in 2012.
Also, I tried in my msbuild task...
<MSBuild Properties="Configuration=Publish;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\MySolution.sln"></MSBuild>
...but msbuild just reported "unknown configuration".
How can I have msbuild run the publish option from the command line?
It appears that there are now some other options for publishing from the command-line. Specifically something along the lines of the following seems possible now with some RC updates to Visual Studio 2012.
msbuild mywap.csproj /p:DeployOnBuild=true;PublishProfile=MyProfileName
For more details check out this post by Scott Hanselman and check out the section on Publishing.
I wasn't able to get the publish to run, but looking at the output from Visual Studio I think I have found an alternate solution. Turns out the obj\Release\AspnetCompileMerge folder has a deployable and clean version of the project. It contains byte identical files to the final output folder.
I did have to change my msbuild script to include the DeployOnBuild option...
<MSBuild Properties="Configuration=Release;DeployOnBuild=True;"
StopOnFirstFailure="true"
Projects="$(BuildDirectory)\BigWave.ALL.sln"></MSBuild>

Windows Azure not generating aspx files

I setup my first Azure Cloude Service as well as Web Role. When I build and then publish application I can only see bin directory with all my dlls. I don't have any folders or aspx files.
\ProjectName.CloudService\bin\Debug\ProjectName.CloudService.csx\roles\Web\bin
How can I compile other files.
Are the .aspx files actually added to the Visual Studio project? (Visual Studio only copies the files it knows about.) If you don't see them in the treeview for the project, click the button at the top that shows files not part of the project, and then right-click and "include in project" on the files you're missing.
If that doesn't work, you might consider heading over to the MSDN forum for Windows Azure: http://social.msdn.microsoft.com/forums/en-us/windowsazure/threads and asking there.
If you look in your Cloud Service project folder, you won't find the aspx files, dlls, etc. The Cloud Service project folder will only contain your configuration files and eventually your packaged Azure deployment files. You'll want to look in bin\Debug\ folder under your Web Role (ASP.NET) project.

Resources