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

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.

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.

azure project msbuild is not copying app.config

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.

How to know database file path after publishing project in visual studio?

I published my project in visual studio by right-click on my project and click publish, the problem is the database file path is changed and i can't find it, i need the path to put it in connection string
can any one help me, please.
Visual Studio will publish an application to a folder where you've told it to; by default it's [project directory]\publish\. The files for a particular publish will be in [publish directory]\Application Files\[revision number]\ by default.
You can check the path by right-clicking on a project in the solution in Visual Studio, selecting Properties and then the Publish tab. If the path is relative, it's in the project directory.
In the Application Files folder, you will find a bunch of files with .deploy extensions; if you've put your configuration in app.config, you should be able to edit it by opening the file [Project name].exe.config.deploy in a text editor.
It's an XML file and you should be able to identify the part you need to change. It will typically look like
<setting name="SettingName" serializeAs="String">
<value>some setting value</value>
</setting>
Installing the application with the created setup file, assuming that the hand-changed revision is the newest one in the Application Files folder, should install it with the new connection string.
I still urge you to consider just changing the app.config file within the project and doing a publish again, this is the way you should be doing it.

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>

Visual Studio 2012 Corrupting ApplicationHost.config File

I just installed Visual Studio 2012 RTM. During the process of trying to create a new web project, I receive the following error:
"Web application projects are currently configured to use IIS Express. To switch back to using the Visual Studio Development server, change the development server option under the Projects and Solutions/Web Projects category of the Tools/Options menu. Configuring IIS Express failed with the following error: Filname: \?\UNC\DEV-FILES\home\mike\MyDocuments\IISExpress\config\applicationHost.config. Line number:1. Error: Configuration file is not well formed XML"
...and project creation subsequently fails.
I already know that I can resolve the this by using the VS dev server, but I should also be able to use IIS when necessary.
When I view the applicationHost file in question, its size is 0kb. It looks like Visual Studio 2012 wiped the contents of the file completely out. I've taken clean backups of the applicationHost file from c:/inetpub/history/ and restored them in the IISExpress folder. Again, when I attempt to create a new project through VS 2012, the file goes from 85KB back down to 0KB.
So I guess I'm trying to figure out why VS 2012 is writing to the applicationHost.config file, what it's trying to write, and how I can resolve the issue.
Thanks,
Mike
I had this problem and solved it by removing encryption on the IISExpress folder. You may or may not need to remove encryption on your My Documents\Visual Studio 2012 folder as well.

Resources